X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Finfoblock.cpp;h=0c293c7635edd36530f35992fda077f4d8d6a136;hb=75acd4b141f45e851a492f089aa9ad24a9552409;hp=dda84e61e14ca1fe4e2a580669dc5ac880d21dd3;hpb=944f31d9d3127b218415fbd1b6ac8f642be88863;p=supertux.git diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index dda84e61e..0c293c763 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -20,6 +20,7 @@ #include #include "infoblock.hpp" + #include "game_session.hpp" #include "resources.hpp" #include "sprite/sprite_manager.hpp" @@ -29,6 +30,8 @@ #include "log.hpp" #include "object/player.hpp" #include "main.hpp" +#include "video/drawing_context.hpp" +#include "object/camera.hpp" namespace { const float SCROLL_DELAY = 0.5; @@ -66,9 +69,9 @@ InfoBlock::~InfoBlock() } void -InfoBlock::hit(Player& ) +InfoBlock::hit(Player& player) { - start_bounce(); + start_bounce(&player); //if (!stopped) { // ringing->remove_me(); @@ -154,6 +157,16 @@ InfoBlock::draw(DrawingContext& context) float x2 = (get_bbox().p1.x + get_bbox().p2.x)/2 + width/2; float y1 = original_y - height; + if(x1 < 0) { + x1 = 0; + x2 = width; + } + + if(x2 > Sector::current()->get_width()) { + x2 = Sector::current()->get_width(); + x1 = x2 - width; + } + // lines_height includes one ITEMS_SPACE too much, so the bottom border is reduced by 4px context.draw_filled_rect(Vector(x1-border, y1-border), Vector(width+2*border, height+2*border-4), Color(0.6f, 0.7f, 0.8f, 0.5f), LAYER_GUI-50);