示例#1
0
文件: why_app.cpp 项目: vdell/inertia
void why::Application::draw_info_box(clan::Canvas &c)
{
	c.fill_rect(m_world_area, clan::Colorf(0.0f, 0.0f, 0.0f, 0.6f));

	static clan:: Colorf linec(clan::Colorf::white);
	linec.set_alpha(0.3f);
	c.draw_box(m_world_area, linec);
}
示例#2
0
void GridComponent::on_render_overlay(clan::Canvas &canvas, const clan::Rect &update_rect)
{
	set_cliprect(canvas, get_size());
	std::vector<GridObject *> selection = main_window->get_selection()->get_selection();
	for (size_t i = 0; i < selection.size(); i++)
	{
		clan::Rect grabbers[8] =
		{
			selection[i]->get_grabber_e(),
			selection[i]->get_grabber_se(),
			selection[i]->get_grabber_s(),
			selection[i]->get_grabber_sw(),
			selection[i]->get_grabber_w(),
			selection[i]->get_grabber_nw(),
			selection[i]->get_grabber_n(),
			selection[i]->get_grabber_ne()
		};

		for (int j=0; j<8; j++)
			grabbers[j] = window_to_component_coords(selection[i]->component_to_window_coords(grabbers[j]));

		clan::Rect pos = window_to_component_coords(selection[i]->component_to_window_coords(selection[i]->get_size()));
		pos.expand(4,4,3,3);
		canvas.draw_box( pos, clan::Colorf(100.0f/255.0f, 100.0f/255.0f, 100.0f/255.0f, 0.25f));

		for (int j=0; j<8; j++)
		{
			canvas.fill_rect( grabbers[j], clan::Colorf::white);
			canvas.draw_box( grabbers[j], clan::Colorf::black);
		}
	}

	if (netselect_box.get_size() != clan::Size(0,0))
	{
		clan::Rect box = netselect_box;
		box.translate(component_container->get_geometry().left, component_container->get_geometry().top);

		clan::Colorf c = clan::Colorf::blue;
		c.set_alpha(0.1f);
		canvas.fill_rect( box, c);
		canvas.draw_box( box, clan::Colorf::blue);
	}

	reset_cliprect(canvas);
}