コード例 #1
0
		bool InputManager::RightMouseButtonDown() const
		{
		if (IsPressed(myMouseState.rgbButtons[static_cast<int> (eMouseButtons::MiddleButton)]) == true)
		{
		return true;
		}
		else
		{
		return false;
		}
		}
コード例 #2
0
ファイル: Input.cpp プロジェクト: DavidKnight247/simcoupe
// Process the additional keys mapped from PC to SAM, ignoring shift state
void ProcessKeyTable (MAPPED_KEY* asKeys_)
{
    // Build the rest of the SAM matrix from the simple non-symbol PC keys
    for (int i = 0 ; asKeys_[i].nKey ; i++)
    {
        if (IsPressed(asKeys_[i].nKey))
        {
            PressSamKey(asKeys_[i].nSamKey);
            PressSamKey(asKeys_[i].nSamMods);
        }
    }
}
コード例 #3
0
ファイル: SCheckBox.cpp プロジェクト: 1vanK/AHRUnrealEngine
/**
 * Gets the check image to display for the current state of the check box
 * @return	The name of the image to display
 */
const FSlateBrush* SCheckBox::OnGetCheckImage() const
{
	ESlateCheckBoxState::Type State = IsCheckboxChecked.Get();

	const FSlateBrush* ImageToUse;
	switch( State )
	{
		case ESlateCheckBoxState::Unchecked:
			ImageToUse = IsPressed() ? GetUncheckedPressedImage() : ( IsHovered() ? GetUncheckedHoveredImage() : GetUncheckedImage() );
			break;
	
		case ESlateCheckBoxState::Checked:
			ImageToUse = IsPressed() ? GetCheckedPressedImage() : ( IsHovered() ? GetCheckedHoveredImage() : GetCheckedImage() );
			break;
	
		default:
		case ESlateCheckBoxState::Undetermined:
			ImageToUse = IsPressed() ? GetUndeterminedPressedImage() : ( IsHovered() ? GetUndeterminedHoveredImage() : GetUndeterminedImage() );
			break;
	}

	return ImageToUse;
}
コード例 #4
0
ファイル: Input.cpp プロジェクト: DavidKnight247/simcoupe
// Process simple key presses
void ProcessKeyTable (SIMPLE_KEY* asKeys_)
{
    // Build the rest of the SAM matrix from the simple non-symbol PC keys
    for (int i = 0 ; i < SK_MAX ; i++)
    {
        if (asKeys_[i].nKey && IsPressed(asKeys_[i].nKey))
        {
            PressSamKey(i);

            if (i != SK_CONTROL)
                PressSamKey(i);
        }
    }
}
コード例 #5
0
ファイル: Button.cpp プロジェクト: ZoogieZork/HoverRace
void Button::Layout()
{
	const Vec2 size = GetSize();
	const auto &s = display.styles;
	
	background->SetSize(size);

	// Move label to center.
	double midX = size.x / 2.0;
	double midY = size.y / 2.0;

	// If there is an icon, position it and shift the text to make room.
	if (icon) {
		double iconY = paddingTop;
		if (IsPressed()) {
			iconY += DEFAULT_PRESS_DEPTH;
		}
		icon->SetPos(paddingLeft, iconY);
		midX += (icon->Measure().x + iconGap) / 2.0;
	}

	if (!IsEnabled()) {
		background->SetColor(s.buttonDisabledBg);
		label->SetColor(s.formDisabledFg);
		label->SetPos(midX, midY);
	}
	else if (IsPressed()) {
		background->SetColor(s.buttonPressedBg);
		label->SetColor(s.formFg);
		label->SetPos(midX, midY + DEFAULT_PRESS_DEPTH);
	}
	else {
		background->SetColor(IsFocused() ? s.buttonFocusedBg : s.buttonBg);
		label->SetColor(s.formFg);
		label->SetPos(midX, midY);
	}
}
コード例 #6
0
ファイル: Input.cpp プロジェクト: DavidKnight247/simcoupe
void ReadKeyboard ()
{
    // Make a copy of the master key table with the real keyboard states
    memcpy(afKeyStates, afKeys, sizeof(afKeyStates));

    // Left-Alt can optionally be used as the SAM Cntrl key
    if (GetOption(altforcntrl) && IsPressed(VK_LMENU))
    {
        ReleaseKey(VK_LMENU);
        PressKey(VK_RCONTROL);
    }

    // AltGr can optionally be used for SAM Edit
    if (GetOption(altgrforedit) && IsPressed(VK_RMENU))
    {
        // Release AltGr and press the context menu key (also used for SAM Edit)
        ReleaseKey(VK_RMENU);
        PressKey(VK_APPS);

        // Also release Ctrl and Alt, which is how AltGr often behaves
        ReleaseKey(VK_LCONTROL);
        ReleaseKey(VK_LMENU);
    }
}
コード例 #7
0
ファイル: UIDisplayWorld.cpp プロジェクト: MagistrAVSH/node3d
bool CUIDisplayWorld::HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
{
	if(WM_CAPTURECHANGED == uMsg)
	{
		if((HWND)lParam != UIGetHWND())
		{
			if(IsPressed() == true)
			{
				ReleaseCapture();
			}
		}
	}
	// ----
	return true;
}
コード例 #8
0
ファイル: Button.cpp プロジェクト: rarosu/BTH-Gomoku
	void Button::MouseEntered()
	{
		if(IsPressed())
		{
			mTintColor = mGraphics.activeColor;
			if(mGraphics.textureDown)
				mTexture = mGraphics.textureDown;
		}
		else
		{
			mTintColor = mGraphics.hoverColor;
			if(mGraphics.textureHover)
				mTexture = mGraphics.textureHover;

		}
	}
コード例 #9
0
ファイル: nuiToggleButton.cpp プロジェクト: jpastuszek/nui3
// Received Mouse events:
bool nuiToggleButton::MouseClicked  (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button)
{
  if (IsDisabled())
    return false;

  if (Button & nglMouseInfo::ButtonLeft)
  {
    mClicked = true;
    mWasPressed = IsPressed();
    SetPressed(!mWasPressed);
    Grab();
    Invalidate();
    return true;
  }
  return false;
}            
コード例 #10
0
void ImageButton::Draw()
{
	float size[2];
	GetSize(size);
	Gui::Image *img;
	if (m_imgPressed && IsPressed())
		img = m_imgPressed;
	else
		img = m_imgNormal;
	if (GetEnabled())
		img->SetModulateColor(Color::WHITE);
	else
		img->SetModulateColor(Color(0.5f,0.5f,0.5f,1.0f));
	img->SetSize(size[0], size[1]);
	img->Draw();
}
コード例 #11
0
ファイル: TaskAperio.c プロジェクト: beber007/zottaos
/* ButtonTask: Checks if the button is still pressed and if not re-enables the button's
** ISR. (Also toggles a GPIO pin for debugging purposes.) */
void ButtonTask(void *argument)
{
  UINT32 i;
  TaskParametersDef *TaskParameters = (TaskParametersDef *)argument;
  ToggleBit(TaskParameters->Flag_Pin);
  for (i = 0; i < TaskParameters->Delay; i += 1);
  ToggleBit(TaskParameters->Flag_Pin);
  if (IsPressed(TaskParameters->Button_Pin))         // Is button still pressed?
     OSScheduleSuspendedTask(TaskParameters->event); // Yes, reschedule the task
  else {
     // No, clear interrupt flag to prevent button rebounds
     ClearInt(TaskParameters->Button_Pin);
     EnableInt(TaskParameters->Button_Pin);
  }
  OSSuspendSynchronousTask();
} /* end of ButtonTask */
コード例 #12
0
ファイル: GuiButton.cpp プロジェクト: Snaar/pioneer
void LabelButton::Draw()
{
	float size[2];
	GetSize(size);
	//printf("%f,%f\n", size[0], size[1]);
	glColor3f(1,1,1);
	//Theme::DrawHollowRect(size);
	if (IsPressed()) {
		Theme::DrawIndent(size);
	} else {
		Theme::DrawOutdent(size);
	}
	glPushMatrix();
	glTranslatef(m_padding, m_padding*0.5, 0);
	m_label->Draw();
	glPopMatrix();
}
コード例 #13
0
void
RadioButton::Draw(BView* container, BRect updateRect)
{
	BRect rect(Bounds());

	if (IsPressed())
		container->SetHighColor((rgb_color){ 120, 0, 0, 255 });
	else
		container->SetHighColor((rgb_color){ 0, 0, 0, 255 });

	container->StrokeRect(rect);

	if (IsSelected()) {
		rect.InsetBy(4, 4);
		container->FillRect(rect);
	}
}
コード例 #14
0
ファイル: CheckBox.cpp プロジェクト: SummerSnail2014/haiku
void
CheckBox::Draw(BView* container, BRect updateRect)
{
	BRect rect(Bounds());

	if (IsPressed())
		container->SetHighColor((rgb_color){ 120, 0, 0, 255 });
	else
		container->SetHighColor((rgb_color){ 0, 0, 0, 255 });

	container->StrokeRect(rect);

	if (IsSelected()) {
		rect.InsetBy(2, 2);
		container->StrokeLine(rect.LeftTop(), rect.RightBottom());
		container->StrokeLine(rect.RightTop(), rect.LeftBottom());
	}
}
コード例 #15
0
ファイル: nuiButton.cpp プロジェクト: hamedmohammadi/nui3
void nuiButton::OnAutoRepeat(const nuiEvent& rEvent)
{
  if (!mAutoRepeat)
    return;

  if (IsPressed())
  {
    nglTime now;
    mUntilRepeat -= (now.GetValue() - mLastTime.GetValue());
    mLastTime = now;
    if (mUntilRepeat <= 0)
    {
      mCurrentRepeatDelay = MAX(mRepeatMinDelay, mCurrentRepeatDelay-mCurrentRepeatDelay/4.0);
      mUntilRepeat = mCurrentRepeatDelay;
      Activated();
    }
  }
}
コード例 #16
0
ファイル: Slider.cpp プロジェクト: CasteyDaSilva/XAGUI
Control* Slider::MouseMoveEvent(int x, int y)
{
	Control* control = Control::MouseMoveEvent(x, y);
	if (control == this && IsPressed())
	{
		if (GetOrientation() == ORIENTATION_VERTICAL)
		{
			SetValue(static_cast<int>((GetMaxValue() - GetMinValue()) / 
				static_cast<float>(GetHeight() / static_cast<float>(y - GetAbsY()))));
		}
		else
		{
			SetValue(static_cast<int>((GetMaxValue() - GetMinValue()) / 
				static_cast<float>(GetWidth() / static_cast<float>(x - GetAbsX()))));
		}
	}
	return control;
}
コード例 #17
0
ECode CPagedViewIcon::DrawableStateChanged()
{
    TextView::DrawableStateChanged();

    // We keep in the pressed state until resetDrawableState() is called to reset the press
    // feedback
    Boolean res;
    IsPressed(&res);
    if (res) {
        SetAlpha(PRESS_ALPHA);
        if (mPressedCallback != NULL) {
            mPressedCallback->IconPressed(this);
        }
    }
    else if (!mLockDrawableState) {
        SetAlpha(1.0f);
    }
    return NOERROR;
}
コード例 #18
0
ファイル: UIEditBox.cpp プロジェクト: constantinbogdan/node3d
void CUIEditBox::OnMouseMove(POINT pt)
{
    if(IsPressed())
    {
        screenToClient(pt);
        // Determine the character corresponding to the coordinates.
        int nCP, nX1st;
        bool bTrail;
        m_Buffer.CPtoX(m_nFirstVisible, FALSE, nX1st);  // X offset of the 1st visible char
        if(m_Buffer.XtoCP(pt.x - m_rcText.left + nX1st, nCP, bTrail))
        {
            // Cap at the NULL character.
            if(bTrail && nCP < m_Buffer.GetTextSize())
                PlaceCaret(nCP + 1);
            else
                PlaceCaret(nCP);
        }
    }
}
コード例 #19
0
/** @return An image that represents this button's border*/
const FSlateBrush* SButton::GetBorder() const
{
	if (!GetShowDisabledEffect() && !IsEnabled())
	{
		return DisabledImage;
	}
	else if ( IsPressed() )
	{
		return PressedImage;
	}
	else if (IsHovered())
	{
		return HoverImage;
	}
	else
	{
		return NormalImage;
	}
}
コード例 #20
0
ファイル: UIListBox.cpp プロジェクト: MagistrAVSH/node3d
void CUIListBox::OnMouseMove(POINT point)
{
	CUICombo::OnMouseMove(point);
	if (m_ScrollBar.ContainsPoint(point))
	{
		return;
	}
	if(IsPressed())
	{
		// Compute the index of the item below cursor

		int nItem;
		if(m_nTextHeight)
			nItem = m_ScrollBar.GetTrackPos() + (point.y - m_rcText.top) / m_nTextHeight;
		else
			nItem = -1;

		// Only proceed if the cursor is on top of an item.

		if(nItem >= (int)m_ScrollBar.GetTrackPos() &&
			nItem < (int)m_Items.size() &&
			nItem < m_ScrollBar.GetTrackPos() + m_ScrollBar.GetPageSize())
		{
			m_nSelected = nItem;
			sendEvent(EVENT_LISTBOX_SELECTION);
		}
		else if(nItem < (int)m_ScrollBar.GetTrackPos())
		{
			// User drags the mouse above window top
			m_ScrollBar.Scroll(-1);
			m_nSelected = m_ScrollBar.GetTrackPos();
			sendEvent(EVENT_LISTBOX_SELECTION);
		}
		else if(nItem >= m_ScrollBar.GetTrackPos() + m_ScrollBar.GetPageSize())
		{
			// User drags the mouse below window bottom
			m_ScrollBar.Scroll(1);
			m_nSelected = __min((int)m_Items.size(), m_ScrollBar.GetTrackPos() + m_ScrollBar.GetPageSize()) - 1;
			sendEvent(EVENT_LISTBOX_SELECTION);
		}
	}
}
コード例 #21
0
BOOL CVWScale3DTool::OnMouseMove(UINT nFlags, POINT pt)
{
	HRESULT hr = S_OK;
	BOOL bHandled = FALSE;
	HWND hWnd;

	int nDeltaX, nDeltaY;

	if (!m_pUIView || !m_pVWRenderRoot || m_bTrackingMouse == VARIANT_FALSE)
		goto EXIT_FAIL;

	// If no delta then leave.
	if( (pt.x == m_cptLast.x )	&& (pt.y == m_cptLast.y ) )
		goto EXIT_FAIL;

	// If left button is down, scale all selected translatable objects.
	if( (MK_LBUTTON & nFlags)	)
	{
		CPoint ptScreen(m_ptAnchor);

		m_pUIView->get_HWND(&hWnd);
		ClientToScreen(hWnd, &ptScreen);
		SetCursorPos(ptScreen.x, ptScreen.y);

		nDeltaX = pt.x - m_cptLast.x;
		nDeltaY = pt.y - m_cptLast.y;

		if (IsPressed(VK_SHIFT))
		{
			nDeltaX = nDeltaY = (nDeltaX - nDeltaY) / 2;
			//nDeltaY = nDeltaX;
		}
		else
			nDeltaY = -nDeltaY;

		hr = ScaleSelectedObjects((float) (nDeltaX/MOUSE_TO_WORLD_FACTOR), (float) (nDeltaY/MOUSE_TO_WORLD_FACTOR) );
		if (FAILED(hr)) goto EXIT_FAIL;
	}
EXIT_FAIL:

	return bHandled;
}
コード例 #22
0
ファイル: Button.cpp プロジェクト: alexjoverm/GaTe
 void Button::Update(const Time& timeElapsed){
    
    sf::Event event;
    sf::Vector2i MousePos=sf::Mouse::getPosition(*RenderWindow::Instance()->renderWindow);

    
    
    if(IsPressed(MousePos.x, MousePos.y) && !controlSound){
            SoundPlayer::Instance()->Play("hover");
            controlSound = true;
    }
    else
            controlSound =false;
    
    
    
   if(texto->getGlobalBounds().contains(sf::Vector2f((float)MousePos.x, (float)MousePos.y)))
       texto->setStyle(sf::Text::Bold);
   else
       texto->setStyle(sf::Text::Regular);
}
コード例 #23
0
ファイル: winuniv.cpp プロジェクト: iokto/newton-dynamics
int wxWindow::GetStateFlags() const
{
    int flags = 0;
    if ( !IsEnabled() )
        flags |= wxCONTROL_DISABLED;

    // the following states are only possible if our application is active - if
    // it is not, even our default/focused controls shouldn't appear as such
    if ( wxTheApp->IsActive() )
    {
        if ( IsCurrent() )
            flags |= wxCONTROL_CURRENT;
        if ( IsFocused() )
            flags |= wxCONTROL_FOCUSED;
        if ( IsPressed() )
            flags |= wxCONTROL_PRESSED;
        if ( IsDefault() )
            flags |= wxCONTROL_ISDEFAULT;
    }

    return flags;
}
コード例 #24
0
ファイル: bmpbuttn.cpp プロジェクト: AlexHayton/decoda
void wxBitmapButton::OnSetBitmap()
{
    wxBitmap bmp;
    if ( !IsEnabled() )
    {
        bmp = m_bmpDisabled;
    }
    else if ( IsPressed() )
    {
        bmp = m_bmpSelected;
    }
    else if ( IsFocused() )
    {
        bmp = m_bmpFocus;
    }
    else
    {
        bmp = m_bmpNormal;
    }

    ChangeBitmap(bmp);
}
コード例 #25
0
//Función para actualizar el juego.
void cGame::Update( float lfTimestep )
{
	//Se actualiza la ventana:
	cWindow::Get().Update();

	//Se actualiza el InputManager.
	cInputManager::Get().Update(lfTimestep);		
	
	//Se comprueba si hay que cerrar la aplicación, por ejemplo a causa de 
	// que el usuario haya cerrado la ventana. 
	mbFinish = mbFinish || cWindow::Get().GetCloseApplication()
		         //También se verifica si se ha producido la acción de entrada que cierra la aplicación:
				 // Pulsar la tecla ESC del teclado, el botón 1 del JoyStick o el botón central del ratón.
	             || IsPressed(eIA_CloseApplication);
	//Si es así, se cambia el booleano
	// que controla el cierre de la aplicación.

	if ( mbFinish )
	{
		return;
	}	
}
コード例 #26
0
ファイル: Button.hpp プロジェクト: Zeken/ofxTableGestures
 void removeCursor(tuio::DirectFinger *f){fingers.erase(f); if (!IsPressed())OnRelease();}
コード例 #27
0
ファイル: Button.hpp プロジェクト: Zeken/ofxTableGestures
 void newCursor(tuio::DirectFinger * f){if (!IsPressed())OnPush(); fingers.insert(f);}
コード例 #28
0
bool InputManager::IsRight() const
{
	return IsPressed(EventKeyboard::KeyCode::KEY_RIGHT_ARROW) && !IsPressed(EventKeyboard::KeyCode::KEY_LEFT_ARROW);
}
コード例 #29
0
bool InputManager::IsJump() const
{
	return IsPressed(EventKeyboard::KeyCode::KEY_UP_ARROW);
}
コード例 #30
0
ファイル: btntextg.cpp プロジェクト: Meridian59/Meridian59
//
/// Paint Text
//
void
TButtonTextGadget::PaintText(TDC& dc, TRect& rect, const tstring& text)
{
  dc.SelectObject(GetFont());

  TColor textColor = TColor::SysBtnText;
  if(!GetEnabled())
    textColor = TColor::Sys3dHilight;
  else if((GetGadgetWindow()->GetFlatStyle()&TGadgetWindow::FlatHotText) && IsHaveMouse())
     textColor = TColor::LtBlue;

   TColor oldTxColor  = dc.SetTextColor(textColor);

  uint format =  DT_SINGLELINE|DT_NOCLIP|DT_END_ELLIPSIS;
  switch(Align){
    case aLeft:
      format |= DT_LEFT;
      break;
    case aRight:
      format |= DT_RIGHT;
      break;
    case aCenter:
      format |= DT_CENTER;
      break;
  }
  switch(LayoutStyle){
    case lTextLeft:
    case lTextRight:
      format |= DT_VCENTER;
      break;
    case lTextTop:
      format |= DT_VCENTER;//DT_BOTTOM;
      break;
    case lTextBottom:
      format |= DT_VCENTER;//DT_TOP;
      break;
  }

  // Create a UI Face object for this button & let it paint the button face
  //
  TPoint  dstPt(rect.TopLeft());

  if (GetButtonState() == Down && GetEnabled() &&
      GetGadgetWindow()->GetFlatStyle()&TGadgetWindow::FlatStandard)
  {
    if(IsHaveMouse())
    {
      if(IsPressed())
      {
        const int dx = (format & DT_CENTER) ? 2 : 1;
        const int dy = (format & DT_VCENTER) ? 2 : 1;
        rect.Offset(dx, dy);
      }
      TUIFace(rect, text, TColor::Sys3dFace,format).Paint(dc, dstPt,
                TUIFace::Normal, true, true);
    }
    else
    {
      TUIFace face(rect, text, TColor::Sys3dFace,format);
      if(GetGadgetWindow()->GadgetGetCaptured()==this)
        face.Paint(dc, dstPt, TUIFace::Normal, true);
      else
        face.Paint(dc, dstPt, TUIFace::Down, IsPressed(), false);
    }
  }
  else
  {
    TUIFace face(rect, text, TColor::Sys3dFace,format);
    if (!GetEnabled())
      face.Paint(dc, dstPt, TUIFace::Disabled, false, false);
    else if (GetButtonState() == Indeterminate)
      face.Paint(dc, dstPt, TUIFace::Indeterm, IsPressed(), false);
    else if (GetButtonState() == Down) // Down and not flat
      face.Paint(dc, dstPt, TUIFace::Down, IsPressed(), false);
    else
      face.Paint(dc, dstPt, TUIFace::Normal, IsPressed(), false);
  }

  dc.SetTextColor(oldTxColor);

  dc.RestoreFont();
}