void Info::draw(CL_GraphicContext &gc) { CL_String text_to_draw = name; CL_Rect draw_rect = get_geometry(); int draw_xpos = 0; int draw_ypos = 0; //CL_Draw::fill(gc, CL_Rect(draw_xpos, draw_ypos, CL_Size(get_width(), get_height())), CL_Colorf(CL_Colorf::red)); CL_Font font = gui->get_font(); CL_FontMetrics metrics = font.get_font_metrics(gc); draw_ypos += (int) metrics.get_ascent(); CL_Colorf color; int time_diff = CL_System::get_time() - activated_time; float color_value = 1.0f - ( ( (float) time_diff ) / 1000.0f); if ( (color_value <= 1.0f) && (color_value > 0.0f) ) { color = CL_Colorf(color_value, color_value/2.0f, color_value/2.0f, color_value); font.draw_text(gc, draw_xpos, draw_ypos, "#", color); color = CL_Colorf(color_value, color_value/2.0f, color_value/2.0f, 1.0f); text_to_draw = name + comment; set_constant_repaint(true); } else { color = CL_Colorf(0, 0, 0, 1.0f); set_constant_repaint(false); } //font.draw_text(gc, draw_xpos + 16, draw_ypos, text_to_draw, CL_Colorf::white); font.draw_text(gc, draw_xpos + 16-1, draw_ypos-1, text_to_draw, color); }
void Info::draw(clan::Canvas &canvas) { std::string text_to_draw = name; clan::Rect draw_rect = get_geometry(); int draw_xpos = 0; int draw_ypos = 0; clan::Font font = get_font(); clan::FontMetrics metrics = font.get_font_metrics(); draw_ypos += (int) metrics.get_ascent(); clan::Colorf color; int time_diff = clan::System::get_time() - activated_time; float color_value = 1.0f - ( ( (float) time_diff ) / 1000.0f); if ( (color_value <= 1.0f) && (color_value > 0.0f) ) { color = clan::Colorf(color_value, color_value/2.0f, color_value/2.0f, color_value); font.draw_text(canvas, draw_xpos, draw_ypos, "#", color); color = clan::Colorf(color_value, color_value/2.0f, color_value/2.0f, 1.0f); text_to_draw = name + comment; set_constant_repaint(true); } else { color = clan::Colorf(0.0f, 0.0f, 0.0f, 1.0f); set_constant_repaint(false); } font.draw_text(canvas, draw_xpos + 16-1, draw_ypos-1, text_to_draw, color); }
GameComponent::GameComponent(const Rect &position, GUIManager* gui_manager) : GUIComponent(gui_manager, GUITopLevelDescription(position, false), "game_component"), radial_menu(0) { set_constant_repaint(true); func_render().set(this, &GameComponent::on_render); func_process_message().set(this, &GameComponent::on_message); Canvas canvas = get_canvas(); background = Image(canvas, "Resources/Images/background.jpg"); radial_menu = new RadialMenu(this); radial_menu->func_selected.set(this, &GameComponent::on_radial_menu_itemselected); font = clan::Font(canvas, "Tahoma", -30); }
Graph_FrameRate::Graph_FrameRate(clan::GUIComponent *parent) : Graph_Time(parent) { func_render().set(this, &Graph_FrameRate::on_render_fr); set_constant_repaint(true); }