support for centered text in scripts
[supertux.git] / src / object / camera.cpp
index 1286db9..216a3b2 100644 (file)
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
 #include <config.h>
 
 #include <stdexcept>
 #include <sstream>
 #include <cmath>
 
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "lisp/list_iterator.h"
-#include "camera.h"
-#include "player.h"
-#include "tilemap.h"
-#include "gameloop.h"
-#include "app/globals.h"
-#include "sector.h"
-#include "object_factory.h"
-
-using namespace SuperTux;
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "lisp/list_iterator.hpp"
+#include "camera.hpp"
+#include "player.hpp"
+#include "tilemap.hpp"
+#include "game_session.hpp"
+#include "sector.hpp"
+#include "main.hpp"
+#include "object_factory.hpp"
 
 Camera::Camera(Sector* newsector)
   : sector(newsector), do_backscrolling(true), scrollchange(NONE),
@@ -151,7 +148,7 @@ static const float EPSILON = .00001;
 static const float max_speed_y = 140;
 
 void
-Camera::action(float elapsed_time)
+Camera::update(float elapsed_time)
 {
   if(mode == NORMAL)
     scroll_normal(elapsed_time);
@@ -213,7 +210,7 @@ Camera::scroll_normal(float elapsed_time)
       target_y = player->get_bbox().p2.y;
 
     // delta_y is the distance we'd have to travel to directly reach target_y
-    float delta_y = translation.y - (target_y - SCREEN_HEIGHT/2);
+    float delta_y = translation.y - (target_y - SCREEN_HEIGHT*2/3);
     // speed is the speed the camera would need to reach target_y in this frame
     float speed_y = delta_y / elapsed_time;