Esempio n. 1
0
		bool OnMouse(PlaceObject* obj, wxMouseEvent& evt)
		{
			if (obj->OnMouseOverride(evt))
				return true;
			else if (evt.LeftDown())
			{
				obj->m_ObjPos = obj->m_ScreenPos = obj->m_Target = Position(evt.GetPosition());
				obj->SendObjectMsg(true);
				obj->m_ObjPos = Position::Unchanged(); // make sure object is stationary even if the camera moves
				SET_STATE(Placing);
				return true;
			}
			else if (evt.Moving())
			{
				obj->m_ObjPos = obj->m_ScreenPos = obj->m_Target = Position(evt.GetPosition());
				obj->SendObjectMsg(true);
				return true;
			}
			else
				return false;
		}
Esempio n. 2
0
		bool OnMouse(PlaceObject* obj, wxMouseEvent& evt)
		{
			if (obj->OnMouseOverride(evt))
				return true;
			else if (evt.LeftUp())
			{
				obj->m_Target = Position(evt.GetPosition());
				// Create the actual object
				obj->SendObjectMsg(false);
				// Go back to preview mode
				SET_STATE(Waiting);
				obj->m_ObjPos = obj->m_ScreenPos = obj->m_Target;
				obj->SendObjectMsg(true);
				return true;
			}
			else if (evt.Dragging())
			{
				obj->m_Target = Position(evt.GetPosition());
				obj->SendObjectMsg(true);
				return true;
			}
			else
				return false;
		}
Esempio n. 3
0
		bool OnMouse(PaintTerrain* obj, wxMouseEvent& evt)
		{
			if (evt.LeftDown())
			{
				obj->m_Pos = Position(evt.GetPosition());
				SET_STATE(PaintingHigh);
				return true;
			}
			else if (evt.RightDown())
			{
				obj->m_Pos = Position(evt.GetPosition());
				SET_STATE(PaintingLow);
				return true;
			}
			else if (evt.Moving())
			{
				POST_MESSAGE(BrushPreview, (true, Position(evt.GetPosition())));
				return true;
			}
			else
			{
				return false;
			}
		}
Esempio n. 4
0
		bool OnMouse(PaintTerrain* obj, wxMouseEvent& evt)
		{
			if (IsMouseUp(evt))
			{
				SET_STATE(Waiting);
				return true;
			}
			else if (evt.Dragging())
			{
				wxPoint pos = evt.GetPosition();
				obj->m_Pos = Position(pos);
				Paint(obj);
				return true;
			}
			else
			{
				return false;
			}
		}
Esempio n. 5
0
		bool OnMouse(ReplaceTerrain* WXUNUSED(obj), wxMouseEvent& evt)
		{
			if (evt.LeftDown())
			{
				Position pos(evt.GetPosition());
				POST_MESSAGE(BrushPreview, (true, pos));
				POST_COMMAND(ReplaceTerrain, (pos, (std::wstring)g_SelectedTexture.wc_str()));
				return true;
			}
			else if (evt.Moving())
			{
				POST_MESSAGE(BrushPreview, (true, Position(evt.GetPosition())));
				return true;
			}
			else
			{
				return false;
			}
		}
Esempio n. 6
0
	void OnDisable()
	{
		POST_MESSAGE(BrushPreview, (false, Position()));
	}