- if(speed > MAX_VEL)
- speed = MAX_VEL;
- else if(speed < -MAX_VEL)
- speed = -MAX_VEL;
-
- /* draw the credits */
-
- draw_background();
-
- white_big_text->drawf("- Credits -", 0, screen->h-scroll, A_HMIDDLE, A_TOP, 2);
-
- for(i = 0, n = 0, d = 0; i < length; i++,n++,d++)
- {
- if(names.item[i] == "")
- n--;
- else
- {
- if(names.item[i][0] == ' ')
- white_small_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll-10, A_HMIDDLE, A_TOP, 1);
- else if(names.item[i][0] == ' ')
- white_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 1);
- else if(names.item[i+1][0] == '-' || names.item[i][0] == '-')
- white_big_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 3);
- else
- blue_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 1);
- }
- }
-
- flipscreen();
-
- if(60+screen->h+(n*18)+(d*18)-scroll < 0 && 20+60+screen->h+(n*18)+(d*18)-scroll < 0)
- done = 1;
-
- scroll += speed;
- if(scroll < 0)
- scroll = 0;
-
- SDL_Delay(35);
-
- if(timer.get_left() < 0)
- {
- frame++;
- timer.start(50);
- }
+void
+TitleScreen::leave()
+{
+ Sector* sector = titlesession->get_current_sector();
+ sector->deactivate();
+ Menu::set_current(NULL);
+}
+
+void
+TitleScreen::draw(DrawingContext& context)
+{
+ Sector* sector = titlesession->get_current_sector();
+ sector->draw(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",
+ Vector(5, SCREEN_HEIGHT - 50), ALIGN_LEFT, LAYER_FOREGROUND1);
+ context.draw_text(white_small_text,
+ _(
+"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),
+ ALIGN_LEFT, LAYER_FOREGROUND1);
+}
+
+void
+TitleScreen::update(float elapsed_time)
+{
+ main_loop->set_speed(0.6f);
+ Sector* sector = titlesession->get_current_sector();
+ sector->update(elapsed_time);
+
+ make_tux_jump();
+
+ Menu* menu = Menu::current();
+ if(menu) {
+ menu->update();
+
+ if(menu == main_menu.get()) {
+ switch (main_menu->check()) {
+ case MNID_STARTGAME:
+ // Start Game, ie. goto the slots menu
+ if(main_world.get() == NULL) {
+ main_world.reset(new World());
+ main_world->load("levels/world1/info");
+ }
+ current_world = main_world.get();
+ start_game();
+ break;
+
+ case MNID_LEVELS_CONTRIB:
+ // Contrib Menu
+ generate_contrib_menu();
+ Menu::push_current(contrib_menu.get());
+ break;
+
+ case MNID_ADDONS:
+ // Add-ons Menu
+ generate_addons_menu();
+ Menu::push_current(addons_menu.get());
+ break;
+
+ case MNID_CREDITS:
+ 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);
+ break;
+ }
+ } else if(menu == contrib_menu.get()) {
+ check_levels_contrib_menu();
+ } else if(menu == addons_menu.get()) {
+ check_addons_menu();
+ } else if (menu == contrib_world_menu.get()) {
+ check_contrib_world_menu();