X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftitle.cpp;h=724d1afb5d7e95cc8c960f9d7c83e2166dd318a0;hb=47c58b6b5d40807eee7bd37fa2fd5d2188a333fd;hp=bf5776a1f25ec41ee46caa8fe941a556e5e320d9;hpb=c686b6e6bc389edb08cef2215b0882b2b0ff4b4b;p=supertux.git diff --git a/src/title.cpp b/src/title.cpp index bf5776a1f..724d1afb5 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -18,55 +18,34 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include -#include "gameconfig.hpp" #include "title.hpp" -#include "mainloop.hpp" -#include "video/drawing_context.hpp" -#include "video/surface.hpp" + +#include "addon/addon_manager.hpp" #include "audio/sound_manager.hpp" +#include "fadeout.hpp" +#include "file_system.hpp" +#include "gameconfig.hpp" +#include "gettext.hpp" #include "gui/menu.hpp" -#include "timer.hpp" -#include "lisp/lisp.hpp" #include "lisp/parser.hpp" -#include "level.hpp" -#include "world.hpp" -#include "game_session.hpp" -#include "worldmap/worldmap.hpp" -#include "player_status.hpp" -#include "tile.hpp" -#include "sector.hpp" -#include "object/tilemap.hpp" +#include "log.hpp" +#include "main.hpp" +#include "mainloop.hpp" #include "object/camera.hpp" #include "object/player.hpp" +#include "options_menu.hpp" #include "resources.hpp" -#include "gettext.hpp" +#include "sector.hpp" #include "textscroller.hpp" -#include "fadeout.hpp" -#include "file_system.hpp" -#include "control/joystickkeyboardcontroller.hpp" -#include "control/codecontroller.hpp" -#include "main.hpp" -#include "log.hpp" -#include "options_menu.hpp" -#include "console.hpp" -#include "random_generator.hpp" -#include "addon/addon_manager.hpp" +#include "video/drawing_context.hpp" +#include "world.hpp" + +#include +#include enum MainMenuIDs { MNID_STARTGAME, @@ -149,7 +128,7 @@ TitleScreen::get_level_name(const std::string& filename) level->get("name", name); return name; } catch(std::exception& e) { - log_warning << "Problem getting name of '" << filename << "': " + log_warning << "Problem getting name of '" << filename << "': " << e.what() << std::endl; return ""; } @@ -231,7 +210,7 @@ TitleScreen::generate_addons_menu() #ifdef HAVE_LIBCURL addons_menu->add_entry(0, std::string(_("Check Online"))); #else - addons_menu->add_deactive(0, std::string(_("Check Online (disabled)"))); + addons_menu->add_inactive(0, std::string(_("Check Online (disabled)"))); #endif //addons_menu->add_hl(); @@ -326,7 +305,7 @@ TitleScreen::make_tux_jump() jumpWasReleased = true; } - // Wrap around at the end of the level back to the beginnig + // Wrap around at the end of the level back to the beginning if(sector->get_width() - 320 < tux->get_pos().x) { sector->activate("main"); sector->camera->reset(tux->get_pos()); @@ -395,15 +374,15 @@ TitleScreen::draw(DrawingContext& context) // FIXME: Add something to scale the frame to the resolution of the screen context.draw_surface(frame.get(), Vector(0,0),LAYER_FOREGROUND1); - context.draw_text(white_small_text, "SuperTux " PACKAGE_VERSION "\n", + context.draw_text(small_font, "SuperTux " PACKAGE_VERSION "\n", Vector(5, SCREEN_HEIGHT - 50), ALIGN_LEFT, LAYER_FOREGROUND1); - context.draw_text(white_small_text, + context.draw_text(small_font, _( "Copyright (c) 2007 SuperTux Devel Team\n" "This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to\n" "redistribute it under certain conditions; see the file COPYING for details.\n" ), - Vector(5, SCREEN_HEIGHT - 50 + white_small_text->get_height() + 5), + Vector(5, SCREEN_HEIGHT - 50 + small_font->get_height() + 5), ALIGN_LEFT, LAYER_FOREGROUND1); } @@ -418,8 +397,6 @@ TitleScreen::update(float elapsed_time) Menu* menu = Menu::current(); if(menu) { - menu->update(); - if(menu == main_menu.get()) { switch (main_menu->check()) { case MNID_STARTGAME: @@ -445,13 +422,14 @@ TitleScreen::update(float elapsed_time) break; case MNID_CREDITS: + Menu::set_current(NULL); main_loop->push_screen(new TextScroller("credits.txt"), new FadeOut(0.5)); break; case MNID_QUITMAINMENU: main_loop->quit(new FadeOut(0.25)); - sound_manager->stop_music(0.25); + sound_manager->stop_music(0.25); break; } } else if(menu == contrib_menu.get()) { @@ -463,9 +441,9 @@ TitleScreen::update(float elapsed_time) } } - // reopen menu of user closed it (so that the app doesn't close when user + // reopen menu if user closed it (so that the app doesn't close when user // accidently hit ESC) - if(Menu::current() == 0) { + if(Menu::current() == 0 && main_loop->has_no_pending_fadeout()) { generate_main_menu(); Menu::set_current(main_menu.get()); } @@ -474,6 +452,7 @@ TitleScreen::update(float elapsed_time) void TitleScreen::start_game() { + Menu::set_current(NULL); std::string basename = current_world->get_basedir(); basename = basename.substr(0, basename.length()-1); std::string worlddirname = FileSystem::basename(basename);