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