Пример #1
0
//================================================================================================================
void MenuEditorSystem::OnMouseDown(WPARAM btnState, int x, int y)
{
	// Start a left button drag of an item
	if ((btnState & MK_LBUTTON) != 0)
	{
		if (dragStartX == -1)
		{
			dragStartX = x;
			dragStartY = y;
		}

		dragPrevX = x;
		dragPrevY = y;
		
		stampPressed = true;
		
		CalculateSelectedMousePosition(x, y);
		
		// Adds a new button to the menu from the selected button image in the button cache if in button
		// place mode
		AddButton();
		
		// Selects a button so it can be moved, if it is moving then this will be skipped
		// so that the button can be placed back on the menu with a left click
		bool goingToMove = MoveButtonStart();
		// If a button is being moved place the button at the clicked position if in button move mode
		if (!goingToMove) MoveButtonEnd();
		
		// Selects a button so it can be cloned, if it is moving then this will be skipped
		// so that the button clone can be added to the menu with a left click
		bool goingToClone = CloneButtonStart();
		// If a button is being moved place the button at the clicked position if in button clone mode
		if (!goingToClone) CloneButtonEnd();
		
		// Selects a button on the menu and deletes it if in button delete mode
		DeleteButton();
		
		// Selects the button to be resized if in button resize mode
		ResizeButtonStart();
		
		// If applicable, Add a text if in text mode
		AddText();
		
		// Selects a text so it can be moved, if it is moving then this will be skipped
		// so that the text can be placed back on the menu with a left click
		goingToMove = MoveTextStart();
		// If a text is being moved place the text at the clicked position if in text move mode
		if (!goingToMove) MoveTextEnd();
		
		// Selects a text so it can be cloned, if it is moving then this will be skipped
		// so that the text clone can be added to the menu with a left click
		goingToClone = CloneTextStart();
		// If a text is being moved place the text at the clicked position if in text clone mode
		if (!goingToClone) CloneTextEnd();
		
		// Selects a text on the menu and deletes it if in text delete mode
		DeleteText();
	}
}
Пример #2
0
//================================================================================================================
void HUDEditorSystem::OnMouseDown(WPARAM btnState, int x, int y)
{
	// Start a left button drag of an item
	if ((btnState & MK_LBUTTON) != 0)
	{
		stampPressed = true;
		
		CalculateSelectedMousePosition(x, y);
		
		// Adds a new image to the hud from the selected image image in the image cache if in image
		// place mode
		AddImage();
		
		// Selects a image so it can be moved, if it is moving then this will be skipped
		// so that the image can be placed back on the hud with a left click
		bool goingToMove = MoveImageStart();
		// If a image is being moved place the image at the clicked position if in image move mode
		if (!goingToMove) MoveImageEnd();
		
		// Selects a image so it can be cloned, if it is moving then this will be skipped
		// so that the image clone can be added to the hud with a left click
		bool goingToClone = CloneImageStart();
		// If a image is being moved place the image at the clicked position if in image clone mode
		if (!goingToClone) CloneImageEnd();
		
		// Selects a image on the hud and deletes it if in image delete mode
		DeleteImage();
		
		// Selects the button to be resized if in button resize mode
		ResizeImageStart();
		
		// If applicable, Add a text if in text mode
		AddText();
		
		// Selects a text so it can be moved, if it is moving then this will be skipped
		// so that the text can be placed back on the hud with a left click
		goingToMove = MoveTextStart();
		// If a text is being moved place the text at the clicked position if in text move mode
		if (!goingToMove) MoveTextEnd();
		
		// Selects a text so it can be cloned, if it is moving then this will be skipped
		// so that the text clone can be added to the hud with a left click
		goingToClone = CloneTextStart();
		// If a text is being moved place the text at the clicked position if in text clone mode
		if (!goingToClone) CloneTextEnd();
		
		// Selects a text on the hud and deletes it if in text delete mode
		DeleteText();
	}
}
Пример #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;
	}
}
Пример #4
0
//================================================================================================================
void HUDEditorSystem::OnMouseMove(WPARAM btnState, int x, int y)
{
	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 image display cover if in image mode
		UpdateDisplaySprite(selToolPoint.x, selToolPoint.y);
		
		// If a image or text is being moved then continue to move it
		MoveImage(selToolPoint.x, selToolPoint.y);
		MoveText(selToolPoint.x, selToolPoint.y);
		
		HighlightImage(selToolPoint.x, selToolPoint.y);
		HighlightText(selToolPoint.x, selToolPoint.y);
	}
	else
	{
		// Move a image display cover if in image mode
		UpdateDisplaySprite(x, y);
		
		// If a image or text is being moved then continue to move it
		MoveImage(x, y);
		MoveText(x, y);
		
		HighlightImage(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 image
		AddImage();
		
		// If applicable, Add a text
		AddText();
		
		// Selects a image on the map and deletes it if in image delete mode
		DeleteImage();
		
		// Selects a text on the map and deletes it if in text delete mode
		DeleteText();
	}
	
	// Move a button or text display cover
	/*if (editMode == ET_Button && (action == A_Place || action == A_Move))
	{
		XMFLOAT2 selToolPoint = SnapToGrid(x, y);
		
		m_StampNormal->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0);
		m_StampHighlight->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0);
	}*/
}