Some documentation for physic and what it does
[supertux.git] / src / supertux / title_screen.cpp
index d77e381..31dc226 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,7 +138,7 @@ 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);