//================================================================================================================
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;
	}
}
//================================================================================================================
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);
	}*/
}