void LevelDot::draw_hover(DrawingContext& gc) { if (accessible()) { gc.print_center(Fonts::pingus_small, Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y) - 44), _(get_plf().get_levelname()), 10000); } else { gc.print_center(Fonts::pingus_small, Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y) - 44), _("???"), 10000); } if (globals::developer_mode) { gc.print_center(Fonts::pingus_small, Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y) - 70), get_plf().get_resname(), 10000); } }
void PingusMenu::draw_background(DrawingContext& gc) { background->draw(gc); gc.draw(logo, Vector2i((gc.get_width()/2) - (logo.get_width()/2), gc.get_height()/2 - 280)); gc.print_left(Fonts::pingus_small, Vector2i(gc.get_width()/2 - 400 + 25, gc.get_height()-140), "Pingus " VERSION " - Copyright (C) 1998-2011 Ingo Ruhnke <*****@*****.**>\n" "See the file AUTHORS for a complete list of contributors.\n" "Pingus comes with ABSOLUTELY NO WARRANTY. This is free software, and you are\n" "welcome to redistribute it under certain conditions; see the file COPYING for details.\n"); gc.draw_fillrect(Rect(0, Display::get_height () - 26, Display::get_width (), Display::get_height ()), Color(0, 0, 0, 255)); gc.print_center(Fonts::pingus_small, Vector2i(gc.get_width() / 2, gc.get_height() - Fonts::pingus_small.get_height() - 8), help); if (0) // display hint { gc.print_center(Fonts::pingus_small, Vector2i(gc.get_width() / 2, gc.get_height() - Fonts::pingus_small.get_height()), hint); } }
void MessageBox::draw_background(DrawingContext& gc) { // Window border and title GUIStyle::draw_raised_box(gc, Rect(0,0,rect.get_width(), rect.get_height())); gc.draw_fillrect(Rect(4,4,rect.get_width()-4, 30), Color(77,130,180)); gc.print_center(Fonts::pingus_small, Vector2i(rect.get_width()/2, 2), m_title); // main text gc.print_center(Fonts::verdana11, Vector2i(rect.get_width()/2, 42), m_text); }
void OptionMenu::draw_background(DrawingContext& gc) { gc.fill_screen(Color(0, 0, 0)); // gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0)); gc.draw(background, Vector2i(gc.get_width()/2 - background.get_width()/2, gc.get_height()/2 - background.get_height()/2)); gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, gc.get_height()/2 - 210), _("Option Menu")); gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2 + 225 + 30, gc.get_height()/2 + 125 - 20), _("Close")); }
void MenuButton::draw (DrawingContext& gc) { if (mouse_over) // pressed { gc.draw(surface_p,Vector2i(x_pos, y_pos)); gc.draw(highlight, Vector2i(x_pos, y_pos)); gc.print_center(font_large, x_pos, y_pos - 28, text); } else { gc.draw(surface_p, Vector2i(x_pos, y_pos)); gc.print_center(font_large, x_pos, y_pos - 28, text); } }
void SliderBox::draw(DrawingContext& gc) { if (globals::developer_mode) gc.draw_rect(rect, Color(0, 255, 255)); if (value == 0) { gc.print_center(Fonts::chalk_normal, Vector2i(rect.left + rect.get_width()/2, rect.top), "off"); } else { for(int i = 0; i < m_steps; ++i) { if (i < value) gc.print_left(Fonts::chalk_normal, Vector2i(rect.left + i*(rect.get_width()-12)/m_steps + 6, rect.top), "|"); //gc.print_left(Fonts::chalk_normal, rect.left + i*(rect.get_width()-12)/20 + 6, rect.top, "l"); } } gc.print_left(Fonts::chalk_normal, Vector2i(rect.left, rect.top), "["); gc.print_right(Fonts::chalk_normal, Vector2i(rect.right, rect.top), "]"); }
void StartScreenComponent::draw(DrawingContext& gc) { // Paint the background wood panel for(int y = 0; y < gc.get_height(); y += background.get_height()) for(int x = 0; x < gc.get_width(); x += background.get_width()) gc.draw(background, Vector2i(x, y)); gc.draw(blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2)); int left_x = gc.get_width()/2 - 150; int right_x = gc.get_width()/2 + 150; int y = gc.get_height()/2 + 40; gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width() /2, gc.get_height()/2 - 230), _(plf.get_levelname())); gc.print_left(Fonts::chalk_normal, Vector2i(gc.get_width() /2 - 300, gc.get_height()/2 - 170), format_description(800 - 200)); y += 32; y += 45; gc.print_left (Fonts::chalk_normal, Vector2i(left_x, y), _("Number of Pingus: ")); gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(plf.get_number_of_pingus())); gc.print_left (Fonts::chalk_normal, Vector2i(left_x, (y += 30)), _("Number to Save: ")); gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(plf.get_number_to_save())); gc.print_left (Fonts::chalk_normal, Vector2i(left_x, (y += 30)), _("Time: ")); gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), time_str); gc.print_center(Fonts::chalk_small, Vector2i(gc.get_width()/2, gc.get_height()/2 + 215), _("Author: ") + plf.get_author()); if (globals::developer_mode) { gc.print_center(Fonts::chalk_small, Vector2i(gc.get_width()/2, gc.get_height()-50), plf.get_resname()); } }
void LevelDot::draw_hover(DrawingContext& gc) { int pos_correction = 0; if (accessible()) { int length = Fonts::pingus_small.bounding_rect(0, 0, _(get_plf().get_levelname())).get_width() / 2; int realpos = gc.world_to_screen(Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y))).x; if (realpos - length < 0) pos_correction = realpos - length; else if (realpos + length > gc.get_width()) pos_correction = realpos + length - static_cast<int>(gc.get_width()); gc.print_center(Fonts::pingus_small, Vector2i(static_cast<int>(pos.x) - pos_correction, static_cast<int>(pos.y) - 44), _(get_plf().get_levelname()), 10000); } else { int length = Fonts::pingus_small.bounding_rect(0, 0, _("locked")).get_width() / 2; int realpos = gc.world_to_screen(Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y))).x; if (realpos - length < 0) pos_correction = realpos - length; else if (realpos + length > gc.get_width()) pos_correction = realpos + length - static_cast<int>(gc.get_width()); gc.print_center(Fonts::pingus_small, Vector2i(static_cast<int>(pos.x) - pos_correction, static_cast<int>(pos.y) - 30), _("locked"), 10000); } if (globals::maintainer_mode) { gc.print_center(Fonts::pingus_small, Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y) - 56), get_plf().get_resname(), 10000); } }
void AddOnMenu::draw_background(DrawingContext& gc) { // gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0)); gc.draw(background, Vector2i(gc.get_width()/2, gc.get_height()/2)); gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, 90), "Add-On Menu"); gc.print_left(Fonts::chalk_normal, Vector2i(120, 145), "X-Mas Pingus Sprites"); gc.print_left(Fonts::chalk_small, Vector2i(140, 170), "christmas look for penguins"); gc.print_left(Fonts::chalk_small, Vector2i(140, 190), "Author: John Foo <*****@*****.**>"); gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2, gc.get_height()/2 + 160), "Update Online [ ]"); gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2 + 245 + 30, gc.get_height()/2 + 150 - 20), _("Close")); gc.draw(ok_button, Vector2i(gc.get_width()/2 + 245, gc.get_height()/2 + 150)); gc.draw(ok_button, Vector2i(610, 145)); }
void StoryDot::draw_hover(DrawingContext& gc) { gc.draw (m_story_dot_highlight, pos); gc.print_center(Fonts::pingus_small, Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y) - 44), _(m_name), 10000); }
void OptionMenu::draw_background(DrawingContext& gc) { // Paint the background wood panel for(int y = 0; y < gc.get_height(); y += m_background.get_height()) for(int x = 0; x < gc.get_width(); x += m_background.get_width()) gc.draw(m_background, Vector2i(x, y)); // gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0)); gc.draw(m_blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2)); gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, gc.get_height()/2 - 240), _("Option Menu")); gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2 + 245 + 30, gc.get_height()/2 + 150 - 20), _("Close")); gc.print_left(Fonts::chalk_normal, Vector2i(gc.get_width()/2 - 320, gc.get_height()/2 + 200), _("Some options require a restart of the game to take effect.")); }
void StoryScreenComponent::draw (DrawingContext& gc) { gc.draw(background, Vector2i(gc.get_width()/2, gc.get_height()/2)); gc.print_center(Fonts::chalk_large, Display::get_width()/2, Display::get_height()/2 - 200, story->get_title()); gc.draw(page_surface, Vector2i(gc.get_width()/2, gc.get_height()/2 - 65)); gc.print_left(Fonts::chalk_normal, Display::get_width()/2 - 280, Display::get_height()/2 + 35, display_text); }
void Button::draw (DrawingContext& gc) { if (enabled) { if (mouse_down && mouse_over) GUIStyle::draw_lowered_box(gc, rect, Color(237, 233, 227), 2); else if (mouse_over) GUIStyle::draw_raised_box(gc, rect, Color(255, 255, 255), 2); else GUIStyle::draw_raised_box(gc, rect, Color(237, 233, 227), 2); } gc.print_center(Fonts::verdana11, Vector2i(rect.left + rect.get_width()/2, rect.top + rect.get_height()/2 - 6), text); }
void StoryScreenComponent::draw (DrawingContext& gc) { // Paint the background wood panel for(int y = 0; y < gc.get_height(); y += background.get_height()) for(int x = 0; x < gc.get_width(); x += background.get_width()) gc.draw(background, Vector2i(x, y)); gc.draw(blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2)); gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, gc.get_height()/2 - 200), story->get_title()); gc.draw(page_surface, Vector2i(gc.get_width()/2, gc.get_height()/2 - 65)); gc.print_left(Fonts::chalk_normal, Vector2i(gc.get_width()/2 - 280, gc.get_height()/2 + 35), display_text); }
void ChoiceBox::draw(DrawingContext& gc) { if (globals::developer_mode) gc.draw_rect(rect, Color(0, 255, 255)); if (!choices.empty()) { if (current_choice >= 0 && current_choice < int(choices.size())) { //if (current_choice != 0) gc.print_left(Fonts::chalk_normal, Vector2i(rect.left, rect.top), "<"); //if (current_choice != int(choices.size())-1) gc.print_right(Fonts::chalk_normal, Vector2i(rect.right, rect.top), ">"); gc.print_center(Fonts::chalk_normal, Vector2i(rect.left + rect.get_width()/2, rect.top), choices[current_choice]); } } }
void ButtonPanel::draw(DrawingContext& gc) { ActionHolder* aholder = server->get_action_holder(); for(std::vector<ActionButton>::size_type i = 0; i < buttons.size(); ++i) { if (current_button == i) gc.draw(highlight, Vector2i(rect.left, rect.top + 38*i)); else gc.draw(background, Vector2i(rect.left, rect.top + 38*i)); gc.draw(buttons[i].sprite, Vector2i(rect.left + 20, rect.top + 38*i + 16)); if (globals::developer_mode) { std::ostringstream out; std::string str = StringUtil::to_string(aholder->get_available(buttons[i].name)); out << aholder->get_available(buttons[i].name) << " / " << aholder->get_used(buttons[i].name); gc.print_left(Fonts::pingus_small, Vector2i(rect.left + 46, rect.top + 5 + 38*i), out.str()); } else { std::string str = StringUtil::to_string(aholder->get_available(buttons[i].name)); gc.print_center(Fonts::pingus_small, Vector2i(rect.left + 46, rect.top + 5 + 38*i), str); } if (show_tip && tip_button == i) { gc.print_left(Fonts::pingus_small, Vector2i(rect.left + 65, rect.top + 5 + 38*i), ActionName::to_screenname(buttons[i].name)); } } }
void ResultScreenComponent::draw(DrawingContext& gc) { // Paint the background wood panel for(int y = 0; y < gc.get_height(); y += background.get_height()) for(int x = 0; x < gc.get_width(); x += background.get_width()) gc.draw(background, Vector2i(x, y)); gc.draw(blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2)); gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, Display::get_height()/2 - 200), _(result.plf.get_levelname())); if (result.success()) { gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, Display::get_height()/2 - 140), _("Success!")); /*gc.print_center(Fonts::pingus_small, gc.get_width()/2, gc.get_height()-30, "..:: Press Space to continue ::..");*/ } else { gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, Display::get_height()/2 - 140), _("Failure!")); /*gc.print_center(Fonts::pingus_normal, gc.get_width()/2, gc.get_height()-30, "..:: Press Space to retry the level ::..");*/ } std::string message; if (result.success()) { if (result.killed == 0 && result.saved == result.total) message = _("Perfect! You saved everyone possible - great!"); else if (result.killed == 0) message = _("No-one got killed, pretty good work."); else if (result.saved == result.needed) message = _("You saved exactly what you needed - you made it, but\n" "maybe you can do better?"); else if (result.killed >= 5) message = _("Not everybody was saved, but still good work!"); else message = _("What can I say, you made it - congratulations!"); } else { if (result.killed == result.total) message = _("You killed everybody, not good."); else if (result.saved == 0) message = _("No-one got saved - I know you can do better."); else if (result.saved > 0) message = _("You didn't save enough, but you saved a few. Next\n" "time you might do better."); else if (result.saved + 1 >= result.needed) message = _("Only one more and you would have made it - try again!"); else if (result.saved + 5 >= result.needed) message = _("Only a handful more and you would have made it - try again!"); else message = _("Better luck next time!"); } gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2, gc.get_height()/2 - 70), message); int left_x = gc.get_width()/2 - 100; int right_x = gc.get_width()/2 + 100; int y = Display::get_height()/2 + 10; gc.print_left(Fonts::chalk_normal, Vector2i(left_x, y), _("Saved: ")); gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(result.saved) + "/" + StringUtil::to_string(result.needed));; gc.print_left(Fonts::chalk_normal, Vector2i(left_x, (y+=30)), _("Died: ")); gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(result.killed)); gc.print_left(Fonts::chalk_normal, Vector2i(left_x, (y+=30)), _("Time left: ")); gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), time_str); }
void WorldmapScreenCloseButton::draw (DrawingContext& gc) { SurfaceButton::draw(gc); gc.print_center(Fonts::chalk_small, Vector2i(44, Display::get_height() - 25), _("Leave?")); }
void WorldmapScreenCreditsButton::draw (DrawingContext& gc) { SurfaceButton::draw(gc); gc.print_center(Fonts::chalk_small, Vector2i(Display::get_width() - 59 - 24, 2), _("Show Ending?")); }
// Draw the background and components void EditorScreen::draw(DrawingContext& gc) { // Black out screen //gc.fill_screen(Color(255,0,255)); // FIXME: Could be removed for added speed gui_manager->draw(gc); if (show_help) { Size size_(640, 400); gc.draw_fillrect(Rect(gc.get_width()/2 - size_.width/2 - 2, gc.get_height()/2 - size_.height/2 - 2, gc.get_width()/2 + size_.width/2 + 2, gc.get_height()/2 + size_.height/2 + 2), Color(0,0,0)); gc.draw_fillrect(Rect(gc.get_width()/2 - size_.width/2, gc.get_height()/2 - size_.height/2, gc.get_width()/2 + size_.width/2, gc.get_height()/2 + size_.height/2), Color(255,255,255)); gc.print_center(Fonts::verdana11, Vector2i(gc.get_width()/2, gc.get_height()/2 - size_.height/2 + 12), _("== Editor Help ==")); int x = gc.get_width()/2 - size_.width/2 + 12; int y = gc.get_height()/2 - size_.height/2 + 36; gc.print_center(Fonts::verdana11, Vector2i(x + 75, y), "A\n" "Shift+A\n" "PageUp, ], w\n" "PageDown, [, s\n" "Shift+PageUp\n" "Shift+PageDown\n" "R\n" "Shift+R\n" "G\n" "Shift+G\n" ); gc.print_left(Fonts::verdana11, Vector2i(x+150, y), _("Select all\n" "Clear Selection\n" "Raise objects\n" "Lower objects\n" "Raise objects to top\n" "Lower objects to bottom\n" "Rotate 90 degree\n" "Rotate 270 degree\n" "Group selected objects\n" "Ungroup selected objects\n")); x = int(gc.get_width()/2 + 12); y = int(gc.get_height()/2) - size_.height/2 + 36; gc.print_center(Fonts::verdana11, Vector2i(x + 50, y), "F\n" "Shift+F\n" "Delete, Backspace\n" "I, K, J, L\n" "Shift+I, K, J, L\n" "B, Shift+B\n" "=, +, -\n"); gc.print_left(Fonts::verdana11, Vector2i(x + 125, y), _("Flip object horizontaly\n" "Flip object vertically\n" "Delete all marked objects\n" "Move objects by one pixel\n" "Move objects by 32 pixel\n" "Toggle background color\n" "Increase/lower repeat\n")); gc.print_left(Fonts::verdana11, Vector2i(gc.get_width()/2 - size_.width/2 + 12, gc.get_height()/2 - 10), _("You should name your level files systematically, i.e. by their theme, " "their number and your nickname:\n\n" " <levelname><number>-<creator>.pingus\n\n" "So if you create your second level with a stone theme, call it: " "stone2-yourname.pingus\n\n" "When you have created a level and want to have it included " "in the game mail it to:\n\n" " [email protected]\n\n" "Only levels published under the GPL are allowed into the game. The editor " "automatically inserts a reference \n" "to the GPL, if you want to have your level under a different license, you " "have to change that reference.\n" )); } }
void draw(DrawingContext& gc) { SurfaceButton::draw(gc); gc.print_center(Fonts::chalk_normal, Vector2i(x_pos + 30, y_pos - 20), _("Play")); }
void draw(DrawingContext& gc) { SurfaceButton::draw(gc); gc.print_center(Fonts::chalk_normal, Vector2i(x_pos + 55, y_pos), _("Back")); }