Fixing SuperTux crashes when compiled on Mac OS X 10.9
[supertux.git] / src / supertux / title_screen.cpp
index d77e381..fbe7fee 100644 (file)
 #include "util/reader.hpp"
 #include "video/drawing_context.hpp"
 
+#include <sstream>
 #include <version.h>
 
-TitleScreen::TitleScreen() :
+TitleScreen::TitleScreen(PlayerStatus* player_status) :
   main_menu(new MainMenu()),
   frame(),
   controller(),
   titlesession()
 {
   controller.reset(new CodeController());
-  titlesession.reset(new GameSession("levels/misc/menu.stl"));
+  titlesession.reset(new GameSession("levels/misc/menu.stl", player_status));
 
   Player* player = titlesession->get_current_sector()->player;
   player->set_controller(controller.get());
   player->set_speedlimit(230); //MAX_WALK_XM
 
-  frame = std::auto_ptr<Surface>(new Surface("images/engine/menu/frame.png"));
+  frame = Surface::create("images/engine/menu/frame.png");
 }
 
 std::string
@@ -89,7 +90,7 @@ TitleScreen::make_tux_jump()
   controller->press(Controller::RIGHT);
 
   // Check if we should press the jump button
-  Rect lookahead = tux->get_bbox();
+  Rectf lookahead = tux->get_bbox();
   lookahead.p2.x += 96;
   bool pathBlocked = !sector->is_free_of_statics(lookahead);
   if ((pathBlocked && jumpWasReleased) || !tux->on_ground()) {
@@ -113,8 +114,6 @@ TitleScreen::~TitleScreen()
 void
 TitleScreen::setup()
 {
-  player_status->reset();
-
   Sector* sector = titlesession->get_current_sector();
   if(Sector::current() != sector) {
     sector->play_music(LEVEL_MUSIC);
@@ -139,17 +138,15 @@ TitleScreen::draw(DrawingContext& context)
   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_surface(frame, Vector(0,0),LAYER_FOREGROUND1);
 
-  context.draw_text(Resources::small_font, "SuperTux " PACKAGE_VERSION "\n",
-                    Vector(5, SCREEN_HEIGHT - 50), ALIGN_LEFT, LAYER_FOREGROUND1);
   context.draw_text(Resources::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"
+                    "SuperTux " PACKAGE_VERSION "\n" +
+                    _("Copyright") + " (c) 2003-2013 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 + Resources::small_font->get_height() + 5),
+                    Vector(5, SCREEN_HEIGHT - 50),
                     ALIGN_LEFT, LAYER_FOREGROUND1);
 }