Exemplo n.º 1
0
	void OverlayTask::Update()
	{
		for (auto it = m_Selected.begin(), end = m_Selected.end(); it != end; ++it)
		{
			const auto& entity = *it;

			auto pos = entity->GetPosition();
			pos.x = ToRenderUnits(pos.x), pos.y = ToRenderUnits(pos.y);
			pos += m_Offset;

			clan::Rectf box(clan::Sizef(50, 50));
			box.translate(pos.x - box.get_width() * 0.5f, pos.y - box.get_height() * 0.5f);

			m_DebugDraw.DrawRectangle(box, GetColour(it));
		}

		if (m_EditCam)
		{
			clan::Colorf rangeColour(1.0f, 0.6f, 0.6f, 0.95f);
			auto center = m_EditCam->GetPosition();
			auto radius = ToRenderUnits(m_CamRange);
			clan::Rectf camRect(center.x - radius, center.y - radius, center.x + radius, center.y + radius);
			m_DebugDraw.DrawRectangle(camRect, rangeColour);
		}

		if (m_PolygonTool && m_PolygonTool->IsActive())
			m_PolygonTool->Draw();
		if (m_RectangleTool && m_RectangleTool->IsActive())
			m_RectangleTool->Draw();
		if (m_CircleTool && m_CircleTool->IsActive())
			m_CircleTool->Draw();
	}
Exemplo n.º 2
0
	void SelectionDrawerTask::Update()
	{
		if (!fe_fzero(m_SelectionBox.get_width()) || !fe_fzero(m_SelectionBox.get_height()))
		{
			auto fillC = clan::Colorf::aquamarine;
			fillC.set_alpha(0.20f);
			m_DebugDraw.DrawRectangle(m_SelectionBox, clan::Colorf::white);
			m_DebugDraw.DrawSolidRectangle(m_SelectionBox, fillC);
		}
	}