Added litte "air arrow" to show where Tux is when he's above the camera. Graphics...
authorChristoph Sommer <mail@christoph-sommer.de>
Sat, 28 Oct 2006 12:09:59 +0000 (12:09 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Sat, 28 Oct 2006 12:09:59 +0000 (12:09 +0000)
SVN-Revision: 4425

data/images/engine/hud/airarrow.png [new file with mode: 0644]
src/object/player.cpp
src/object/player.hpp

diff --git a/data/images/engine/hud/airarrow.png b/data/images/engine/hud/airarrow.png
new file mode 100644 (file)
index 0000000..e059ba0
Binary files /dev/null and b/data/images/engine/hud/airarrow.png differ
index ccecefb..f995622 100644 (file)
@@ -116,6 +116,7 @@ Player::Player(PlayerStatus* _player_status, const std::string& name)
   smalltux_gameover = sprite_manager->create("images/creatures/tux_small/smalltux-gameover.sprite");
   smalltux_star = sprite_manager->create("images/creatures/tux_small/smalltux-star.sprite");
   bigtux_star = sprite_manager->create("images/creatures/tux_big/bigtux-star.sprite");
+  airarrow.reset(new Surface("images/engine/hud/airarrow.png"));
 
   sound_manager->preload("sounds/bigjump.wav");
   sound_manager->preload("sounds/jump.wav");
@@ -803,6 +804,13 @@ Player::draw(DrawingContext& context)
   if(!visible)
     return;
 
+  // if Tux is above camera, draw little "air arrow" to show where he is x-wise
+  if (Sector::current() && Sector::current()->camera && (get_bbox().p2.y + 16 < Sector::current()->camera->get_translation().y)) {
+    float px = get_pos().x + (get_bbox().p2.x - get_bbox().p1.x - airarrow.get()->get_width()) / 2;
+    float py = Sector::current()->camera->get_translation().y;
+    context.draw_surface(airarrow.get(), Vector(px, py), LAYER_HUD - 1);
+  }
+
   TuxBodyParts* tux_body;
 
   if (player_status->bonus == GROWUP_BONUS)
index a66f80b..2f21f6d 100644 (file)
@@ -278,6 +278,8 @@ private:
   Sprite* smalltux_star;
   Sprite* bigtux_star;
 
+  std::auto_ptr<Surface> airarrow; /**< arrow indicating Tux' position when he's above the camera */
+
   Vector floor_normal;
   void try_grab();