void PhoneModeDefaultOperatable::MouseMoved(int x, int y)
{
    for (int8_t i = 0; i < 2; ++i)
        for (int8_t j = 0; j < 2; ++j)
            if (x > PHONE_BUTTON_POS_X[j] && x < PHONE_BUTTON_POS_X[j] + PHONE_BUTTON_WIDTH)
                if (y > PHONE_BUTTON_POS_Y[i] && y < PHONE_BUTTON_POS_Y[i] + PHONE_BUTTON_HEIGHT)
                    HighlightButton(j, i);
}
Пример #2
0
//*********************************************************************************
void CBCGPToolBoxPage::OnMouseMove(UINT nFlags, CPoint point) 
{
	CBCGPControlBar::OnMouseMove(nFlags, point);

	int nPrevHighlightedButton = m_nHighlightedButton;
	m_nHighlightedButton = HitTest (point);

	if (m_nHighlightedButton != nPrevHighlightedButton)
	{
		HighlightButton (m_nHighlightedButton);

		if (m_nHighlightedButton != -1)
		{
			if (nPrevHighlightedButton == -1)
			{
				SetCapture ();
			}
		}
		else
		{
			ReleaseCapture ();
		}
	}
}
Пример #3
0
//================================================================================================================
void MenuEditorSystem::OnMouseMove(WPARAM btnState, int x, int y)
{
	int dX, dY, tdX, tdY;
	
	// Calculate movement delta from previous frame
	if (dragPrevX != -1)
	{
		dX = x - dragPrevX;
		dY = y - dragPrevY;
		tdX = x - dragStartX;
		tdY = y - dragStartY;
	}
	
	if (gridMode == GM_Snap)
	{
		XMFLOAT2 selToolPoint = SnapToGrid(x, y);
		
		m_StampNormal->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0);
		m_StampHighlight->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0);
		
		// Move a button display cover if in button mode
		UpdateDisplaySprite(selToolPoint.x, selToolPoint.y);
		
		// If a button or text is being moved then continue to move it
		MoveButton(selToolPoint.x, selToolPoint.y);
		MoveText(selToolPoint.x, selToolPoint.y);
		
		HighlightButton(selToolPoint.x, selToolPoint.y);
		HighlightText(selToolPoint.x, selToolPoint.y);
	}
	else
	{
		// Move a button display cover if in button mode
		UpdateDisplaySprite(x, y);
		
		// If a button or text is being moved then continue to move it
		MoveButton(x, y);
		MoveText(x, y);
		
		HighlightButton(x, y);
		HighlightText(x, y);
	}
	
	// Start a left button drag of an item
	if ((btnState & MK_LBUTTON) != 0)
	{
		CalculateSelectedMousePosition(x, y);
		
		stampPressed = true;
		
		// If applicable, Add a button
		AddButton();
		
		// If applicable, Add a text
		AddText();
		
		// Selects a button on the map and deletes it if in button delete mode
		DeleteButton();
		
		// Selects a text on the map and deletes it if in text delete mode
		DeleteText();
	}
	
	// Remember current mouse co-ordinates for next frame
	if (dragPrevX != -1)
	{
		dragPrevX = x;
		dragPrevY = y;
	}
}