void TitlebarImpl::draw() { CL_Display::push_translate(parent->get_screen_x(), parent->get_screen_y()); // FIXME: Hack should be done via has_mouse_over(), but that doesn't include child components if (parent->get_parent()->get_position().is_inside(CL_Point(CL_Mouse::get_x(), CL_Mouse::get_y()))) //parent->get_parent()->has_mouse_over()) { CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), CL_Size(parent->get_width()-1, parent->get_height())), CL_Color(250, 250, 250)); } else { CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), CL_Size(parent->get_width()-1, parent->get_height())), CL_Color(240, 240, 240)); } Fonts::verdana11.draw(4, 0, title); CL_Display::pop_modelview(); }
void Radar::draw(CL_GraphicContext& gc) { FloatVector2d end(0.0f, 64.0f); end = end.rotate(angle); end += pos; background.draw(int(pos.x), int(pos.y), &gc); GameObjManager* objs = GameWorld::current()->get_game_obj_manager(); for (GameObjManager::iterator i = objs->begin(); i != objs->end(); ++i) { (*i)->draw_radar(*this); } GameWorld::current()->get_buildingmap()->draw_radar(*this); CL_Display::draw_line(int(pos.x), int(pos.y - 5), int(pos.x), int(pos.y + 5), CL_Color(0, 255, 0)); CL_Display::draw_line(int(pos.x - 5), int(pos.y), int(pos.x + 5), int(pos.y), CL_Color(0, 255, 0)); }
void TileMapPaintToolImpl::draw() { TilemapLayer tilemap = TilemapLayer::current(); if (tilemap.is_null()) return; switch(mode) { case TileMapPaintToolImpl::SELECTING: if (CL_Keyboard::get_keycode(CL_KEY_LSHIFT)) selection.draw(CL_Color(255, 128, 128, 100)); else selection.draw(); break; default: int tile_size = tilemap.get_tileset().get_tile_size(); // Draw the brush: for(int y = 0; y < brush.get_height(); ++y) for(int x = 0; x < brush.get_width(); ++x) { Tile* tile = tilemap.get_tileset().create(brush.at(x, y)); if (tile) { CL_Sprite sprite = tile->get_sprite(); sprite.set_alpha(0.5f); sprite.draw((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size); CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size), CL_Size(tile_size, tile_size)), CL_Color(255, 255, 255, 100)); } else if (brush.is_opaque()) { CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size), CL_Size(tile_size, tile_size)), CL_Color(255, 255, 255, 100)); } else { CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size), CL_Size(tile_size, tile_size)), CL_Color(255, 255, 255, 50)); } } break; } }
void PlayNode::Draw(CL_Rect area) { CL_Display::fill_rect(area, CL_Gradient(CL_Color(0,0,54), CL_Color(54,0,100), CL_Color(100, 50, 0), CL_Color(100, 0, 55))); mapRect = CL_Rect(area.left + 300, area.top + 100, area.right - 100, area.bottom - 100); mapNode->Draw(mapRect); inventoryRect = CL_Rect(area.left + 50, area.top + 100, area.left + 250, area.bottom - 100); inventoryNode->Draw(inventoryRect); }
void CL_TreeItem_Silver::on_paint() { CL_Rect rect = item->get_screen_rect(); int height = rect.get_height(); int font_height = font->get_height(item->get_text(0)); if(item->has_mouse_over()) CL_Display::fill_rect(rect, CL_Color(232, 236, 241)); if(item->get_node()->is_selected()) CL_Display::fill_rect(rect, CL_Color(184, 195, 209, 150)); CL_TreeView *treeview = item->get_node()->get_treeview(); int columns = treeview->get_column_count(); if(columns == 0) columns = 1; // Draw columns for(int x = 0, i = 0; i < columns; ++i) { int dx = 0; if(i == 0) { dx += item->get_text_margin(); CL_Surface *icon = item->get_icon(); if(icon) { icon->draw( rect.left + x + 1, rect.top + (height - icon->get_height()) / 2); dx += icon->get_width(); } } CL_Component *comp = item->get_component(i); if(comp) { comp->set_position(CL_Rect(x + dx + 4, 0, x + dx + 4 + treeview->get_column_width(i), height)); comp->paint(); } else { font->draw( rect.left + x + dx + 4, rect.top + (height - font_height) / 2, item->get_text(i)); } x += treeview->get_column_width(i); if(i == 0) x -= item->get_node()->get_placement_offset(); } }
EditorMap::EditorMap(bool create) : impl() { if (create) { impl.reset(new EditorMapImpl()); impl->background_color = CL_Color(100, 80, 100); impl->foreground_color = CL_Color(255, 80, 255); impl->modified = false; impl->serial = 0; impl->has_bounding_rect = false; impl->bounding_rect = CL_Rect(0,0,0,0); } }
void CollisionManager::draw(View& view) { for(Shapes::iterator i = shapes.begin(); i != shapes.end(); ++i) { switch (i->type) { case SHAPE_CIRCLE: view.get_sc().color().draw_circle(i->circle.x, i->circle.y, i->circle.radius, CL_Color(255, 0, 0)); break; case SHAPE_RECT: { CL_Color color(255, 0, 0); Math::Quad quad = rect2quad(i->rect); view.get_sc().color().draw_line(quad.a.x, quad.a.y, quad.b.x, quad.b.y, color); view.get_sc().color().draw_line(quad.b.x, quad.b.y, quad.c.x, quad.c.y, color); view.get_sc().color().draw_line(quad.c.x, quad.c.y, quad.d.x, quad.d.y, color); view.get_sc().color().draw_line(quad.d.x, quad.d.y, quad.a.x, quad.a.y, color); } break; default: std::cout << "CollisionManager: unhandled type: " << i->type << std::endl; } } }
void Slider::draw() { CL_Display::push_modelview(); CL_Display::add_translate(get_screen_x(), get_screen_y()); CL_Display::fill_rect(CL_Rect(CL_Point(0, get_height()/2 - 2), CL_Size(get_width(), 5)), CL_Color(255, 255, 255, 255)); CL_Display::fill_rect(CL_Rect(CL_Point(int(-2 + (value/(end-start)) * get_width()), 0), CL_Size(5, get_height())), CL_Color(0, 0, 0, 255)); CL_Display::pop_modelview(); }
/** Builds the dialog screen. */ void CADialog::buildScreen() { // Menu Backgroud: // if( !modal ) CA_RES->menu_bg->draw( CL_Rect(0,0, CA_APP->width,CA_APP->height) ); int ew = CA_RES->gui_edge2->get_width(); int eh = CA_RES->gui_edge2->get_height(); int bw = CA_RES->gui_border2->get_width(); int bh = CA_RES->gui_border1->get_height(); CL_Display::fill_rect( CL_Rect(left+bw, top+bh, right-bw, bottom-bh), CL_Color(0, 0, 0, 64) ); // Edges: // CA_RES->gui_edge1->draw( left, top ); CA_RES->gui_edge2->draw( right-ew, top ); CA_RES->gui_edge3->draw( left, bottom-eh ); CA_RES->gui_edge4->draw( right-ew, bottom-eh ); // Borders: // CA_RES->gui_border1->draw( CL_Rect(left+ew, top, left+ew+width-2*ew, top+bh) ); CA_RES->gui_border2->draw( CL_Rect(right-bw, top+eh, right-bw+bw, top+eh+height-2*eh) ); CA_RES->gui_border3->draw( CL_Rect(left+ew, bottom-bh, left+ew+width-2*ew, bottom-bh+bh) ); CA_RES->gui_border4->draw( CL_Rect(left, top+eh, left+bw, top+eh+height-2*eh) ); }
void Radar::draw_blip(const FloatVector2d& arg_pos, int size, float red, float green, float blue) { // Callculate the distance between 'pos' and the vehicle that holds // the radar FloatVector2d diff = arg_pos; diff -= player->get_current_unit()->get_pos(); diff *= 1/30.0f; float alpha =(diff.get_length() / 64.0); alpha *= alpha * alpha; alpha = 1.0f - alpha; if (diff.get_length() < 64.0) { //diff = diff.rotate(-vehicle->get_angle () + (3.14159/2), FloatVector2d (0, 0, 1.0)); CL_Display::fill_rect(CL_Rect(int(pos.x + diff.x) - size, int(pos.y + diff.y) - size, int(pos.x + diff.x) + size, int(pos.y + diff.y) + size), CL_Color(int(255*red), int(255*green), int(255*blue), int(255*alpha))); } }
void CL_TreeView_Silver::on_paint_header() { // Header if(treeview->is_header_visible()) { CL_Rect rect = header_area->get_screen_rect(); // Header background CL_Display::fill_rect( CL_Rect( rect.left + 1, rect.top + 1, rect.left + rect.get_width() - 1, rect.top + rect.get_height() - 4), CL_Gradient( CL_Color(245, 246, 247), CL_Color(245, 246, 247), CL_Color(235, 238, 241), CL_Color(235, 238, 241))); CL_Display::fill_rect( CL_Rect( rect.left + 1, rect.top + rect.get_height() - 4, rect.left + rect.get_width() - 1, rect.top + rect.get_height()), CL_Gradient( CL_Color(235, 238, 241), CL_Color(235, 238, 241), CL_Color(186, 187, 188), CL_Color(186, 187, 188))); // Draw columns int x = 0; int columns = treeview->get_column_count(); for(int i = 0; i < columns; ++i) { font->draw( rect.left + x + 6, rect.top + 4, treeview->get_column_name(i)); x += treeview->get_column_width(i); CL_Display::draw_line( rect.left + x, rect.top + 1, rect.left + x, rect.top + rect.get_height(), CL_Color(128, 142, 159)); CL_Display::draw_line( rect.left + x + 1, rect.top + 1, rect.left + x + 1, rect.top + rect.get_height(), CL_Color::white); } } }
void MenuItem::draw(int x, int y) { CL_Display::fill_rect(CL_Rect(x, y, x + 150, y + Fonts::font.get_height() + 2), CL_Color(85,85,0, 230)); Fonts::font.set_alignment(origin_top_left); Fonts::font.draw(x + 10, y + 1, label); }
void L_Particle::draw(CL_GraphicContext &gc, int x_shift, int y_shift) { surface->set_scale(current_size,current_size); surface->set_angle(CL_Angle(current_radian, cl_radians)); surface->set_color( CL_Color(current_color.r,current_color.g,current_color.b,current_color.a) ); surface->draw(gc, x_pos+x_shift, y_pos+y_shift); }
CL_Color Tile::calc_color() { CL_PixelBuffer buffer = get_pixelbuffer(); buffer.lock(); unsigned char* buf = static_cast<unsigned char*>(buffer.get_data()); int len = buffer.get_height() * buffer.get_width(); int red = 0; int green = 0; int blue = 0; int alpha = 0; switch (buffer.get_format().get_depth()) { case 8: { CL_Palette palette = buffer.get_palette(); for(int i = 0; i < len; ++i) { red += palette.colors[buf[i]].get_red(); green += palette.colors[buf[i]].get_green(); blue += palette.colors[buf[i]].get_blue(); alpha += 255; } } break; case 24: for(int i = 0; i < len; ++i) { red += buf[3*i + 0]; green += buf[3*i + 1]; blue += buf[3*i + 2]; alpha += 255; } break; case 32: for(int i = 0; i < len; ++i) { int a = buf[4*i + 0]; alpha += a; red += buf[4*i + 3]*a/255;; green += buf[4*i + 2]*a/255;; blue += buf[4*i + 1]*a/255;; } break; } buffer.unlock(); return CL_Color(static_cast<int>(red / len), static_cast<int>(green / len), static_cast<int>(blue / len), static_cast<int>(alpha / len)); }
void StartScreen::draw () { if (logo_mode == S_STARTLOGO) { if (display_time <= 2.0f) logo.set_alpha ((display_time/2.0f)); else logo.set_alpha (1.0f); //FIXME:Display2 CL_Display::clear_display (); logo.draw (CL_Display::get_width ()/2, CL_Display::get_height ()/2, display->get_gc ()); } else if (logo_mode == S_FADETOGAME) { if (display_time <= 1.5f) { logo.set_alpha (1.0f - (display_time/1.5f)); logo.draw (CL_Display::get_width ()/2, CL_Display::get_height ()/2, display->get_gc ()); } else logo_mode = S_GAME; } else if (logo_mode == S_GAME) { // do nothing } else if (logo_mode == S_ENDLOGO) { if (display_time <= 1.5f) endlogo.set_alpha ((display_time/1.5f)); else endlogo.set_alpha (1.0f); endlogo.draw (CL_Display::get_width ()/2, CL_Display::get_height ()/2); } else if (logo_mode == S_FADETOBLACK) { endlogo.set_alpha (1.0f); endlogo.draw (CL_Display::get_width ()/2, CL_Display::get_height ()/2); CL_Display::fill_rect (CL_Rect(0, 0, CL_Display::get_width (), CL_Display::get_height ()), CL_Color(0, 0, 0, int(255.0f * display_time/2.0f))); if (display_time >= 2.0f) logo_mode = S_QUIT; } }
void OnionSkinLayer::update() { impl->canvas->get_gc()->clear(CL_Color(0, 0, 0, 0)); for (std::vector<EditorMap>::size_type i = 0; i < impl->editormaps.size(); ++i) { impl->canvas2->get_gc()->clear(CL_Color(0, 0, 0, 0)); impl->canvas2->get_gc()->push_modelview(); impl->canvas2->get_gc()->add_scale(1.0f/SCALE, 1.0f/SCALE); impl->editormaps[i].draw(EditorMapComponent::current()->get_gc_state(), impl->canvas2->get_gc()); impl->canvas2->get_gc()->pop_modelview(); impl->canvas2->sync_surface(); impl->surface2.set_color(impl->color[i]); impl->surface2.draw(0, 0, impl->canvas->get_gc()); impl->canvas->sync_surface(); } }
void TileEditor::draw() { CL_Display::push_translate(get_screen_x(), get_screen_x()); //no_tile.draw(0, 0); CL_Display::fill_rect(CL_Rect(0, 0, 32, 32), CL_Color(155, 0, 155)); if (tile) { tile->get_sprite().draw(0, 0); CL_Display::flush(); for(int tile_y = 0; tile_y < 8; ++tile_y) for(int tile_x = 0; tile_x < 8; ++tile_x) { if (tile->get_col(tile_x, tile_y)) { CL_Display::fill_rect(CL_Rect(tile_x*16, tile_y*16, tile_x*16 + 16, tile_y*16 + 16), CL_Color(255, 0, 0, 128)); } } CL_Display::flush(); if (has_mouse_over()) { CL_Display::fill_rect(CL_Rect(CL_Point(int(mouse_pos.x)/16 * 16, int(mouse_pos.y)/16 * 16), CL_Size(16, 16)), CL_Color(255, 255, 255, 128)); } } else { } CL_Display::pop_modelview(); }
OnionSkinLayer::OnionSkinLayer(int width, int height) : impl(new OnionSkinLayerImpl()) { impl->surface = CL_Surface(CL_PixelBuffer(width/SCALE, height/SCALE, width*4/SCALE, CL_PixelFormat::rgba8888)); impl->surface2 = CL_Surface(CL_PixelBuffer(width/SCALE, height/SCALE, width*4/SCALE, CL_PixelFormat::rgba8888)); try { impl->canvas = new CL_Canvas(impl->surface); impl->canvas->get_gc()->clear(CL_Color(0, 0, 0, 0)); impl->canvas->get_gc()->flush(); impl->canvas->sync_surface(); impl->canvas2 = new CL_Canvas(impl->surface2); impl->canvas2->get_gc()->clear(CL_Color(0, 0, 0, 0)); impl->canvas2->get_gc()->flush(); impl->canvas2->sync_surface(); } catch(CL_Error& err) { std::cout << "CL_Error: " << err.message << std::endl; throw err; } }
CL_ColorHSVi::operator CL_Color() { int hue = cl_min(359,cl_max(0,h)); int saturation = cl_min(255,cl_max(0,s)); int value = cl_min(255,cl_max(0,v)); if (saturation == 0) { return CL_Color(value, value, value, a); } int section = (int)(hue / 60); int f = ((hue*256) / 60) - (section*256); int p = (value * (255 - saturation))/255; int q = (value * (255 - ((saturation * f) /256) ))/255; int t = (value * (255 - ((saturation * (256 - f)) / 256) ))/255; if (section == 1) { return CL_Color(q, value, p, a); } if (section == 2) { return CL_Color(p, value, t, a); } if (section == 3) { return CL_Color(p, q, value, a); } if (section == 4) { return CL_Color(t, p, value, a); } if (section == 5) { return CL_Color(value, p, q, a); } return CL_Color(value, t, p, a); }
CGameMenu::CGameMenu(CGame* _game) { pointer=new CL_Sprite("menu/pointer",_game->GetResman()); title=new CL_Sprite("menu/title",_game->GetResman()); darktitle=new CL_Sprite("menu/darktitle",_game->GetResman()); devby=new CL_Sprite("menu/devby",_game->GetResman()); copyright=new CL_Sprite("intro/copyright", _game->GetResman()); fnt_about=CMisc::fnt_about; about_str=new string; *about_str=CL_String::load("about", _game->GetResman()); context_main.sprites[0].spr=darktitle; context_main.sprites[0].pos=CL_Point(150,0); context_main.sprites[1].spr=devby; context_main.sprites[1].pos=CL_Point(20,510); context_about.sprites[0].spr=copyright; context_about.sprites[0].pos=CL_Point(200,0); copyright->set_color(CL_Color(101,101,101)); context_current=&context_main; curhandler=&CGameMenu::MenuMain; game=_game; MainMenu=new GCL_Menu(game->GetResman(),CMisc::fnt_menu); //btn_game=MainMenu->AddButton(SCR_W/2,150,true,"menu/game",SCR_W/4,10); btn_game_server=MainMenu->AddButton(SCR_W/2,70,true,"menu/createserver",SCR_W/6,10); btn_game_client=MainMenu->AddButton(SCR_W/2,150,true,"menu/connectserver",SCR_W/6,10); btn_options=MainMenu->AddButton(SCR_W/2,230,true,"menu/options",SCR_W/4,10); btn_help=MainMenu->AddButton(SCR_W/2,310,true,"menu/help",SCR_W/4,10); btn_about=MainMenu->AddButton(SCR_W/2,390,true,"menu/about",SCR_W/4,10); btn_bglist=MainMenu->AddButton(SCR_W/2,470,true,"menu/bglist",SCR_W/4,10); btn_exit=MainMenu->AddButton(SCR_W/2,550,true,"menu/exit",SCR_W/4,10); CL_SoundBuffer theme("menu/menu_theme", game->GetResman()); menu_theme=new CL_SoundBuffer_Session; *menu_theme=theme.play(); page_main=0; /*page_game=MainMenu->AddPage(); btn_game_back=MainMenu->AddButton(50,500,false,"menu/back",10,10); btn_game_server=MainMenu->AddButton(SCR_W/2,200,true,"menu/createserver",SCR_W/6,10); btn_game_client=MainMenu->AddButton(SCR_W/2,300,true,"menu/connectserver",SCR_W/6,10);*/ page_gametype=MainMenu->AddPage(); btn_gametype_back=MainMenu->AddButton(50,500,false,"menu/back",10,10); btn_gametype_deathmatch=MainMenu->AddButton(100,50,false,"menu/deathmatch"); MainMenu->SetBtnCheck(btn_gametype_deathmatch,true); MainMenu->MakeRadio(btn_gametype_deathmatch,GCL_Button::GCL_BUTTON_RADIO); btn_gametype_teamdeathmatch=MainMenu->AddButton(100,120,false,"menu/teamdeathmatch"); MainMenu->MakeRadio(btn_gametype_teamdeathmatch,GCL_Button::GCL_BUTTON_RADIO); btn_gametype_next=MainMenu->AddButton(600,500,false,"menu/next",10,10); page_gameparams=MainMenu->AddPage(); team1=team4=BGA_TEAM_RED; team2=team3=BGA_TEAM_BLUE; btn_gameparams_back=MainMenu->AddButton(50,500,false,"menu/back",10,10); btn_gameparams_next=MainMenu->AddButton(600,500,false,"menu/next",10,10); ebx_gameparams_name1=MainMenu->AddEditBox(50,300,"Игрок 1"); MainMenu->SetBtnParam(ebx_gameparams_name1,GCL_EDITBOX_MAXLEN,"15"); MainMenu->SetBtnValue(ebx_gameparams_name1,"Игрок 1"); btn_gameparams_cmd1=MainMenu->AddButton(20,307,false,"menu/switchteam"); MainMenu->MakeRadio(btn_gameparams_cmd1,GCL_Button::GCL_BUTTON_CHECKBOX); MainMenu->SetBtnCheck(btn_gameparams_cmd1,team1-1); ebx_gameparams_name2=MainMenu->AddEditBox(450,300,"Игрок 2"); MainMenu->SetBtnParam(ebx_gameparams_name2,GCL_EDITBOX_MAXLEN,"15"); MainMenu->SetBtnValue(ebx_gameparams_name2,"Игрок 2"); btn_gameparams_cmd2=MainMenu->AddButton(420,307,false,"menu/switchteam"); MainMenu->MakeRadio(btn_gameparams_cmd2,GCL_Button::GCL_BUTTON_CHECKBOX); MainMenu->SetBtnCheck(btn_gameparams_cmd2,team2-1); ebx_gameparams_name3=MainMenu->AddEditBox(50,350,"Игрок 3"); MainMenu->SetBtnParam(ebx_gameparams_name3,GCL_EDITBOX_MAXLEN,"15"); MainMenu->SetBtnValue(ebx_gameparams_name3,"Игрок 3"); btn_gameparams_cmd3=MainMenu->AddButton(20,357,false,"menu/switchteam"); MainMenu->MakeRadio(btn_gameparams_cmd3,GCL_Button::GCL_BUTTON_CHECKBOX); MainMenu->SetBtnCheck(btn_gameparams_cmd3,team3-1); ebx_gameparams_name4=MainMenu->AddEditBox(450,350,"Игрок 4"); MainMenu->SetBtnParam(ebx_gameparams_name4,GCL_EDITBOX_MAXLEN,"15"); MainMenu->SetBtnValue(ebx_gameparams_name4,"Игрок 4"); btn_gameparams_cmd4=MainMenu->AddButton(420,357,false,"menu/switchteam"); MainMenu->MakeRadio(btn_gameparams_cmd4,GCL_Button::GCL_BUTTON_CHECKBOX); MainMenu->SetBtnCheck(btn_gameparams_cmd4,team4-1); ebx_gameparams_localgamers=MainMenu->AddEditBox(20,250,"Локальные игроки"); MainMenu->SetBtnParam(ebx_gameparams_localgamers,GCL_EDITBOX_MAXLEN,"1"); MainMenu->SetBtnParam(ebx_gameparams_localgamers,GCL_EDITBOX_ONLYNUM,"true"); MainMenu->SetBtnValue(ebx_gameparams_localgamers ,"2"); ebx_gameparams_fraglimit=MainMenu->AddEditBox(20,400,"Лимит фрагов"); MainMenu->SetBtnParam(ebx_gameparams_fraglimit,GCL_EDITBOX_MAXLEN,"3"); MainMenu->SetBtnParam(ebx_gameparams_fraglimit,GCL_EDITBOX_ONLYNUM,"true"); MainMenu->SetBtnValue(ebx_gameparams_fraglimit,"20"); ebx_gameparams_timelimit=MainMenu->AddEditBox(420,400,"Лимит времени"); MainMenu->SetBtnParam(ebx_gameparams_timelimit,GCL_EDITBOX_MAXLEN,"3"); MainMenu->SetBtnParam(ebx_gameparams_timelimit,GCL_EDITBOX_ONLYNUM,"true"); MainMenu->SetBtnValue(ebx_gameparams_timelimit,"0"); game_type=BGA_GAME_DEATHMATCH; page_about=MainMenu->AddPage(); btn_about_back=MainMenu->AddButton(400,565,true,"menu/back",SCR_W/4,10); MainMenu->ChangePage(page_main); }
void setRacketColor(const CL_Color _racketColor) { racketColor = CL_Color(_racketColor.get_red(), _racketColor.get_green(), _racketColor.get_blue()); }
void CL_InputBox_Silver::on_paint() { bool has_focus = inputbox->is_enabled() && inputbox->has_focus(); CL_Rectf rect = inputbox->get_screen_rect(); int width = inputbox->get_width(); // Outline if(has_focus) { // Fill CL_Display::fill_rect( CL_Rectf(rect.left + 1, rect.top + 1, rect.right - 1, rect.bottom - 1), CL_Color(245, 250, 255)); // Main border CL_Display::draw_rect( rect, CL_Color(90, 118, 149)); // Highlight CL_Display::draw_rect( CL_Rectf(rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1), CL_Color(206, 220, 233)); } else { // Fill CL_Display::fill_rect( CL_Rectf(rect.left + 1, rect.top + 1, rect.right - 1, rect.bottom - 1), CL_Color::white); // Main border CL_Display::draw_rect( rect, CL_Color(128, 142, 159)); } // For easy reference, put inputfield-text into local variable const char *text = inputbox->get_text().c_str(); // Calculate offset for vertical centering int vert_center = (inputbox->get_height () - font->get_height ()) / 2; // Calculate scroll offset int character_offset = 0; int pixel_offset = 0; int text_width = (int) inputbox->in_password_mode() ? font->get_width('*')*strlen(text) : font->get_width(text); if (text_width > width - border_size * 2) { while ( text_width >= width - border_size * 2 && character_offset + 1 < inputbox->get_cursor_position()) { int w = inputbox->in_password_mode() ? font->get_width('*') : font->get_width(text[character_offset]); character_offset++; pixel_offset += w; text_width -= w; } } // Display marked text, if any if(has_focus) { if (inputbox->has_marked_text()) { int start = inputbox->get_selection_start(); int end = start + inputbox->get_selection_length(); int mark_x1 = 0, mark_x2 = 0; int i; if (inputbox->in_password_mode()) { int w = font->get_width('*'); if (start > 0) mark_x1 += start*w; if (end > start) mark_x2 += (end-start)*w; } else { for(i = 0; i < start; i++) mark_x1 += font->get_width(text[i]); for(i = start; i < end; i++) mark_x2 += font->get_width(text[i]); } CL_Display::fill_rect( CL_Rect( inputbox->get_screen_x()+border_size + mark_x1 - 1, inputbox->get_screen_y() + vert_center, inputbox->get_screen_x()+border_size + mark_x1 + mark_x2, inputbox->get_screen_y() + font->get_height() + vert_center), CL_Color(204, 208, 232)); } } // Display text if(inputbox->is_enabled() == false) { if (inputbox->in_password_mode()) font_disabled->draw(inputbox->get_screen_x()+border_size, inputbox->get_screen_y()+vert_center, std::string(strlen(text+character_offset), '*')); else font_disabled->draw(inputbox->get_screen_x()+border_size, inputbox->get_screen_y()+vert_center, &text[character_offset]); } else { if (inputbox->in_password_mode()) font->draw(inputbox->get_screen_x()+border_size, inputbox->get_screen_y()+vert_center, std::string(strlen(text+character_offset), '*')); else font->draw(inputbox->get_screen_x()+border_size, inputbox->get_screen_y()+vert_center, &text[character_offset]); } // Show blinking cursor if(has_focus) { if (show_cursor) { int cursor_x = border_size - pixel_offset; if (inputbox->in_password_mode()) cursor_x += inputbox->get_cursor_position() * font->get_width('*'); else for(int i = 0; i < inputbox->get_cursor_position(); i++) cursor_x += font->get_width(text[i]); CL_Display::draw_line( inputbox->get_screen_x() + cursor_x, inputbox->get_screen_y() + vert_center, inputbox->get_screen_x() + cursor_x, inputbox->get_screen_y() + vert_center + font->get_height() - 1, CL_Color::black); } unsigned int cur_time = CL_System::get_time(); if (cur_time >= cursor_blink_time) { cursor_blink_time = cur_time + 400; show_cursor = !show_cursor; } } }
void CL_Window_Silver::on_paint() { CL_Rectf rect = window->get_screen_rect(); // Titlebar CL_Display::fill_rect( CL_Rectf(rect.left + 2, rect.top + 4, rect.right - 2, rect.top + titlebar_height - 3), CL_Color(206, 217, 228)); CL_Display::draw_line( rect.left + 2, rect.top + 2, rect.right - 2, rect.top + 2, CL_Color(251, 253, 255)); CL_Display::draw_line( rect.left + 2, rect.top + 3, rect.right - 2, rect.top + 3, CL_Color(236, 238, 240)); CL_Display::draw_line( rect.left + 2, rect.top + titlebar_height - 3, rect.right - 2, rect.top + titlebar_height - 3, CL_Color(180, 202, 224)); CL_Display::draw_line( rect.left + 2, rect.top + titlebar_height - 2, rect.right - 2, rect.top + titlebar_height - 2, CL_Color(144, 180, 218)); CL_Display::draw_line( rect.left + 2, rect.top + titlebar_height - 1, rect.right - 2, rect.top + titlebar_height - 1, CL_Color(128, 142, 159)); // Outer window frame CL_Display::draw_rect( rect, CL_Color(128, 142, 159)); // Inner window frame CL_Display::draw_rect( CL_Rectf(rect.left + 1, rect.top + 1, rect.right - 1, rect.bottom - 1), CL_Color(161, 172, 185)); // Client area CL_Display::fill_rect( CL_Rectf(rect.left + 2, rect.top + titlebar_height, rect.right - 2, rect.bottom - 2), CL_Gradient( CL_Color(255, 255, 255, 235), CL_Color(255, 255, 255, 235), CL_Color(224, 228, 232, 235), CL_Color(224, 228, 232, 235))); int y = (titlebar_height + 2 - font->get_height()) / 2; if(window->is_enabled() == false) font_disabled->draw(static_cast<int>(rect.left + 7), static_cast<int>(rect.top + y), window->get_title()); else { font->draw(static_cast<int>(rect.left + 7), static_cast<int>(rect.top + y), window->get_title()); font->draw(static_cast<int>(rect.left + 8), static_cast<int>(rect.top + y), window->get_title()); } /* CL_Rect rect = window->get_screen_rect(); int offx = window->get_screen_x(); int offy = window->get_screen_y(); int w_width = rect.get_width(); int w_height = rect.get_height(); // Vertical shadows CL_Display::draw_line(offx+w_width + 0, offy + 5, offx+w_width + 0, offy+w_height + 0, CL_Color(0, 0, 0, 64)); CL_Display::draw_line(offx+w_width + 1, offy + 5, offx+w_width + 1, offy+w_height + 1, CL_Color(0, 0, 0, 51)); CL_Display::draw_line(offx+w_width + 2, offy + 5, offx+w_width + 2, offy+w_height + 2, CL_Color(0, 0, 0, 38)); CL_Display::draw_line(offx+w_width + 3, offy + 5, offx+w_width + 3, offy+w_height + 3, CL_Color(0, 0, 0, 25)); CL_Display::draw_line(offx+w_width + 4, offy + 5, offx+w_width + 4, offy+w_height + 4, CL_Color(0, 0, 0, 13)); // Horizontal shadows CL_Display::draw_line(offx + 5, offy+w_height + 0, offx+w_width + 1, offy+w_height + 0, CL_Color(0, 0, 0, 64)); CL_Display::draw_line(offx + 5, offy+w_height + 1, offx+w_width + 2, offy+w_height + 1, CL_Color(0, 0, 0, 51)); CL_Display::draw_line(offx + 5, offy+w_height + 2, offx+w_width + 3, offy+w_height + 2, CL_Color(0, 0, 0, 38)); CL_Display::draw_line(offx + 5, offy+w_height + 3, offx+w_width + 4, offy+w_height + 3, CL_Color(0, 0, 0, 25)); CL_Display::draw_line(offx + 5, offy+w_height + 4, offx+w_width + 5, offy+w_height + 4, CL_Color(0, 0, 0, 13)); */ }
void GameSession::update() { int delta_wait = static_cast<int>(1000/args->fps); float delta = delta_wait/1000.0f;; deltas += delta; ++loops; if (CL_Keyboard::get_keycode(CL_KEY_D)) Guile::enter_repl(); unsigned int last_time = CL_System::get_time (); // Update stuff if (!do_pause) { collision_mgr->clear(); AIManager::instance()->update(delta); world->update(delta); collision_mgr->run(); view->update(delta); } GameWorld::current()->draw(*view); GameWorld::current()->draw_energie(*view); view->get_sc().render(); view->get_sc().light().fill_screen(CL_Color(50, 50, 100)); if (draw_colmap) collision_mgr->draw(*view); if (!do_pause) DisplayManager::current()->update(delta); DisplayManager::current()->draw(*(CL_Display::get_current_window()->get_gc())); if (CL_Mouse::get_keycode(CL_MOUSE_MIDDLE)) world->add(new ExplosionParticle(view->screen_to_world(FloatVector2d(CL_Mouse::get_x (), CL_Mouse::get_y ())), FloatVector2d(), 3.0f)); // Comment out for variable frame rate int sleep_time = (last_time + delta_wait) - CL_System::get_time(); if (sleep_time > 0) CL_System::sleep (sleep_time); // Flip front and backbuffer. This makes the changes visible: CL_Display::flip (); if (!args->video_record_directory.empty()) { std::stringstream filename; filename << args->video_record_directory; filename.width(8); filename.fill('0'); filename << frames; filename << ".ppm"; Screenshot::write_screenshot_pnm(filename.str()); } ++frames; // Update keyboard input and handle system events: // Exits the loop if ClanLib requests shutdown - for instance if // someone closes the window. CL_System::keep_alive(); clanlib_call_post_keep_alive_func(); InputManager::update(delta); InputEventLst lst = InputManager::get_controller().get_events(); for(InputEventLst::iterator i = lst.begin(); i != lst.end(); ++i) { if (i->type == BUTTON_EVENT) { if (i->button.name == MENU_BUTTON && i->button.is_down()) { if (control_state == MENU_CONTROL) { menu_hide(); control_state = UNIT_CONTROL; } else { menu_show(0); control_state = MENU_CONTROL; } } else if (i->button.name == USE_BUTTON && i->button.is_down()) { // FIXME: Unclean hack gh_call0(gh_lookup("join-nearest-vehicle")); } } } switch (control_state) { case MENU_CONTROL: if (DisplayManager::current()->get_menu()) DisplayManager::current()->get_menu()->process_events(InputManager::get_controller().get_events()); else { std::cout << "Error: Menu not available, fallback to unit" << std::endl; control_state = UNIT_CONTROL; } break; case UNIT_CONTROL: player->get_current_unit()->update_controlls(InputManager::get_controller()); break; default: std::cout << "Unknown ControlState, switching back to UNIT_CONTROL" << std::endl; control_state = UNIT_CONTROL; break; } InputManager::clear(); }
// The start of the Application int App::main(int argc, char **argv) { quit = false; running_test = 0; // Initialize ClanLib base components CL_SetupCore setup_core; // Initialize the ClanLib display component CL_SetupDisplay setup_display; // Initilize the OpenGL drivers CL_SetupGL setup_gl; // Create a console window for text-output if not available CL_ConsoleWindow console("Console", 80, 200); console.redirect_stdio(); std::cout << "Press 1-5 for different tests! (Test 3 and 5 not applicable for ClanLib 0.8)" << std::endl; try { // This opens a window, including the frame size // If you want more control over the window, pass CL_DisplayWindowDescription to CL_DisplayWindow // (This is useful to create a borderless window of a specific size) // If you require target specific control over the window, use the derived CL_OpenGLWindowDescription // (This contains the multisampling options) CL_DisplayWindow window("ClanLib SpriteSpeed Test", 1000, 1000); // Connect the Window close event CL_Slot slot_quit = window.sig_window_close().connect(this, &App::on_window_close); // Connect a keyboard handler to on_key_up() CL_Slot slot_input_up = (window.get_ic()->get_keyboard()).sig_key_down().connect(this, &App::on_input_up); CL_GraphicContext *gc = window.get_gc(); CL_ResourceManager resources("resources.xml"); explosion1 = CL_Sprite("Explosion1", &resources); explosion2 = CL_Sprite("Explosion2", &resources); explosions_same_tex.reserve(10000); for(int i=0; i<10000; i++) { explosions_same_tex.push_back(CL_Sprite(explosion1)); if(i % 2 == 0) explosions_diff_tex.push_back(CL_Sprite(explosion1)); else explosions_diff_tex.push_back(CL_Sprite(explosion2)); } // Run until someone presses escape while (!quit) { float delta_time = dump_fps() / 1000.0f; CL_Display::clear(CL_Color(0, 0, 51)); if(running_test == 0) CL_System::sleep(100); if(running_test == 1) draw_equal_tex_equal_sprites(gc, 10000, delta_time); if(running_test == 2) draw_equal_tex_diff_sprites(gc, 10000, delta_time); if(running_test == 3) draw_equal_tex_diff_sprites_batch(gc, 10000, delta_time); if(running_test == 4) draw_diff_tex_diff_sprites(gc, 10000, delta_time); if(running_test == 5) draw_diff_tex_diff_sprites_batch(gc, 10000, delta_time); // Flip the display, showing on the screen what we have drawed since last call to flip() CL_Display::flip(); // This call processes user input and other events CL_System::keep_alive(1); } explosions_same_tex.clear(); explosions_diff_tex.clear(); explosion1 = CL_Sprite(); explosion2 = CL_Sprite(); } catch(CL_Error error) { std::cout << "Exception caught : " << error.message.c_str() << std::endl; // Display console close message and wait for a key console.display_close_message(); return -1; } return 0; }
void OnionSkinLayer::clear() { impl->canvas->get_gc()->clear(CL_Color(0, 0, 0, 0)); impl->canvas->sync_surface(); }
// проверяет нажатую кнопку и выполняет соответствующие действия void CGameMenu::Navigate(void) { int btn=MainMenu->GetClickedButton(); //ничего не нажато if (btn==-1) return; int page=MainMenu->GetCurPage(); if (page==page_main) { /*if (btn==btn_game) { MainMenu->FadeOn(context_main); MainMenu->ChangePage(page_game); context_current=&context_null; MainMenu->FadeOff(); }*/ if (btn==btn_game_server) { MainMenu->FadeOn(context_main); MainMenu->ChangePage(page_gametype); context_current=&context_null; MainMenu->FadeOff(); } if (btn==btn_about) { MainMenu->FadeOn(context_main); MainMenu->ChangePage(page_about); context_current=&context_about; MainMenu->FadeOff(context_about); y=650;r=g=b=101;ch=dif=1; copyright->set_color(CL_Color(101,101,101)); curhandler=&CGameMenu::MenuAbout; } if (btn==btn_exit) { std::cout<<"Exit button clicked.\n"; MainMenu->FadeOn(context_main); quit=true; } } if (page==page_about) { if (btn==btn_about_back) { MainMenu->FadeOn(context_about); MainMenu->ChangePage(page_main); fnt_about->set_color(101,101,101); copyright->set_color(101,101,101); context_current=&context_main; MainMenu->FadeOff(context_main); curhandler=&CGameMenu::MenuMain; } } /*if (page==page_game) { if (btn==btn_game_back) { MainMenu->FadeOn(); MainMenu->ChangePage(page_main); context_current=&context_main; MainMenu->FadeOff(context_main); } }*/ if (page==page_gametype) { if (btn==btn_gametype_back) { MainMenu->FadeOn(); MainMenu->ChangePage(page_main); context_current=&context_main; MainMenu->FadeOff(context_main); } if (btn==btn_gametype_next) { MainMenu->FadeOn(); MainMenu->ChangePage(page_gameparams); MainMenu->FadeOff(); } if (btn==btn_gametype_deathmatch) { MainMenu->SetBtnCheck(btn_gametype_deathmatch,true); MainMenu->SetBtnCheck(btn_gametype_teamdeathmatch,false); game_type=BGA_GAME_DEATHMATCH; } if (btn==btn_gametype_teamdeathmatch) { MainMenu->SetBtnCheck(btn_gametype_teamdeathmatch,true); MainMenu->SetBtnCheck(btn_gametype_deathmatch,false); game_type=BGA_GAME_TEAMDEATHMATCH; } } if (page==page_gameparams) { if (btn==btn_gameparams_back) { MainMenu->FadeOn(); MainMenu->ChangePage(page_gametype); MainMenu->FadeOff(); } if (btn==btn_gameparams_next) { MainMenu->FadeOn(); menu_theme->stop(); int fr_lim,t_lim,loc_p; fr_lim=CL_String::to_int(MainMenu->GetBtnValue(ebx_gameparams_fraglimit)); t_lim=CL_String::to_int(MainMenu->GetBtnValue(ebx_gameparams_timelimit)); loc_p=CL_String::to_int(MainMenu->GetBtnValue(ebx_gameparams_localgamers)); if (loc_p<1) loc_p=1; else if (loc_p>4) loc_p=4; game->SetLocalNames(MainMenu->GetBtnValue(ebx_gameparams_name1),MainMenu->GetBtnValue(ebx_gameparams_name2), MainMenu->GetBtnValue(ebx_gameparams_name3),MainMenu->GetBtnValue(ebx_gameparams_name4)); game->SetLocalCommands(team1,team2,team3,team4); string mapname="platetown"; LOG<<LOG.Time()<<"Запуск игры (карта - "<<mapname<<", лимит фрагов - "<<fr_lim<<", лимит времени - "<<t_lim<<" мин.)\n"; game->SetLimits(fr_lim,t_lim); game->NewGame(game_type,loc_p,mapname); game->MainLoop(); menu_theme->play(); MainMenu->ChangePage(page_main); context_current=&context_main; MainMenu->FadeOff(context_main); } if (btn==ebx_gameparams_name1) { MainMenu->SetBtnCheck(ebx_gameparams_name1,true); MainMenu->SetBtnCheck(ebx_gameparams_name2,false); MainMenu->SetBtnCheck(ebx_gameparams_name3,false); MainMenu->SetBtnCheck(ebx_gameparams_name4,false); MainMenu->SetBtnCheck(ebx_gameparams_fraglimit,false); MainMenu->SetBtnCheck(ebx_gameparams_timelimit,false); MainMenu->SetBtnCheck(ebx_gameparams_localgamers,false); } if (btn==ebx_gameparams_name2) { MainMenu->SetBtnCheck(ebx_gameparams_name1,false); MainMenu->SetBtnCheck(ebx_gameparams_name2,true); MainMenu->SetBtnCheck(ebx_gameparams_name3,false); MainMenu->SetBtnCheck(ebx_gameparams_name4,false); MainMenu->SetBtnCheck(ebx_gameparams_fraglimit,false); MainMenu->SetBtnCheck(ebx_gameparams_timelimit,false); MainMenu->SetBtnCheck(ebx_gameparams_localgamers,false); } if (btn==ebx_gameparams_name3) { MainMenu->SetBtnCheck(ebx_gameparams_name1,false); MainMenu->SetBtnCheck(ebx_gameparams_name2,false); MainMenu->SetBtnCheck(ebx_gameparams_name3,true); MainMenu->SetBtnCheck(ebx_gameparams_name4,false); MainMenu->SetBtnCheck(ebx_gameparams_fraglimit,false); MainMenu->SetBtnCheck(ebx_gameparams_timelimit,false); MainMenu->SetBtnCheck(ebx_gameparams_localgamers,false); } if (btn==ebx_gameparams_name4) { MainMenu->SetBtnCheck(ebx_gameparams_name1,false); MainMenu->SetBtnCheck(ebx_gameparams_name2,false); MainMenu->SetBtnCheck(ebx_gameparams_name3,false); MainMenu->SetBtnCheck(ebx_gameparams_name4,true); MainMenu->SetBtnCheck(ebx_gameparams_fraglimit,false); MainMenu->SetBtnCheck(ebx_gameparams_timelimit,false); MainMenu->SetBtnCheck(ebx_gameparams_localgamers,false); } if (btn==ebx_gameparams_fraglimit) { MainMenu->SetBtnCheck(ebx_gameparams_name1,false); MainMenu->SetBtnCheck(ebx_gameparams_name2,false); MainMenu->SetBtnCheck(ebx_gameparams_name3,false); MainMenu->SetBtnCheck(ebx_gameparams_name4,false); MainMenu->SetBtnCheck(ebx_gameparams_fraglimit,true); MainMenu->SetBtnCheck(ebx_gameparams_timelimit,false); MainMenu->SetBtnCheck(ebx_gameparams_localgamers,false); } if (btn==ebx_gameparams_timelimit) { MainMenu->SetBtnCheck(ebx_gameparams_name1,false); MainMenu->SetBtnCheck(ebx_gameparams_name2,false); MainMenu->SetBtnCheck(ebx_gameparams_name3,false); MainMenu->SetBtnCheck(ebx_gameparams_name4,false); MainMenu->SetBtnCheck(ebx_gameparams_fraglimit,false); MainMenu->SetBtnCheck(ebx_gameparams_timelimit,true); MainMenu->SetBtnCheck(ebx_gameparams_localgamers,false); } if (btn==ebx_gameparams_localgamers) { MainMenu->SetBtnCheck(ebx_gameparams_name1,false); MainMenu->SetBtnCheck(ebx_gameparams_name2,false); MainMenu->SetBtnCheck(ebx_gameparams_name3,false); MainMenu->SetBtnCheck(ebx_gameparams_name4,false); MainMenu->SetBtnCheck(ebx_gameparams_fraglimit,false); MainMenu->SetBtnCheck(ebx_gameparams_timelimit,false); MainMenu->SetBtnCheck(ebx_gameparams_localgamers,true); } if (btn==btn_gameparams_cmd1) { team1=(team1==1 ? 2 : 1); MainMenu->SetBtnCheck(btn_gameparams_cmd1,team1-1); } if (btn==btn_gameparams_cmd2) { team2=(team2==1 ? 2 : 1); MainMenu->SetBtnCheck(btn_gameparams_cmd2,team2-1); } if (btn==btn_gameparams_cmd3) { team3=(team3==1 ? 2 : 1); MainMenu->SetBtnCheck(btn_gameparams_cmd3,team3-1); } if (btn==btn_gameparams_cmd4) { team4=(team4==1 ? 2 : 1); MainMenu->SetBtnCheck(btn_gameparams_cmd4,team4-1); } } }
void CL_TreeView_Silver::on_paint_node(CL_TreeNode *node, CL_Point &point) { CL_Component *component = node->get_component(); CL_Component *client_area = treeview->get_client_area(); int height = component->get_height(); int mid = (height) / 2; // Should we draw decoration ? bool draw_decoration = true; if(node->is_root()) draw_decoration = node->get_treeview()->is_root_decoration_visible(); // Find what y offset we're drawing at point.y -= scrollbar->get_value(); // Find what x offset we're drawing at int x_offset = 0; if(draw_decoration) x_offset = 12; int screen_x = client_area->get_screen_x(); int screen_y = client_area->get_screen_y(); // Is the node visible? if (point.y + height >= 0 && point.y <= client_area->get_height()) { if(draw_decoration) { // Draw collapse box if(node->has_children()) { CL_Display::draw_rect( CL_Rect( screen_x + point.x, screen_y + point.y + mid - 5, screen_x + point.x + 9, screen_y + point.y + mid + 4), CL_Color(128, 142, 159)); CL_Display::fill_rect( CL_Rect( screen_x + point.x + 1, screen_y + point.y + mid - 4, screen_x + point.x + 8, screen_y + point.y + mid + 3), CL_Gradient( CL_Color::white, CL_Color::white, CL_Color(230, 235, 240), CL_Color(230, 235, 240))); CL_Display::fill_rect( CL_Rect( screen_x + point.x + 2, screen_y + point.y + mid - 3, screen_x + point.x + 7, screen_y + point.y + mid + 2), CL_Gradient( CL_Color(217, 222, 227), CL_Color(217, 222, 227), CL_Color::white, CL_Color::white)); // Horizontal line CL_Display::draw_line( screen_x + point.x + 2.0f, screen_y + point.y + mid - 1.0f, screen_x + point.x + 7.0f, screen_y + point.y + mid - 1, CL_Color::black); // Vertical line if(node->is_collapsed()) CL_Display::draw_line( screen_x + point.x + 4.0f, screen_y + point.y + mid - 3.0f, screen_x + point.x + 4.0f, screen_y + point.y + mid + 2.0f, CL_Color::black); } } // Size and place child component component->set_position(point.x + x_offset, point.y); node->set_placement_offset(point.x + x_offset); // Draw component component->show(true); component->sig_begin_paint(); component->sig_paint()(); component->sig_end_paint(); } else { component->show(false); } // Move down for next component point.y += scrollbar->get_value(); point.y += height; // If it has any children, adjust the x-position for the children if(node->is_collapsed() == false) point.x += 3 + x_offset; }
void CL_TreeView_Silver::on_paint() { // Outline CL_Rect rect = treeview->get_screen_rect(); CL_Display::draw_rect(rect, CL_Color(128, 142, 159)); }
void Box::draw_window(const CL_Rect& rect) { draw_panel(CL_Rect(rect.left+1, rect.top+1, rect.right-2, rect.bottom-2)); CL_Display::draw_rect(rect, CL_Color(0, 0, 0)); }