4 #include "resources.hpp"
6 #include "math/rect.hpp"
7 #include "sprite/sprite_manager.hpp"
8 #include "sprite/sprite.hpp"
9 #include "video/drawing_context.hpp"
10 #include "lisp/lisp.hpp"
11 #include "floating_image.hpp"
13 FloatingImage::FloatingImage(const std::string& spritefile)
14 : layer(LAYER_FOREGROUND1 + 1), visible(false), anchor(ANCHOR_MIDDLE)
16 sprite.reset(sprite_manager->create(spritefile));
19 FloatingImage::~FloatingImage()
24 FloatingImage::update(float elapsed_time)
30 FloatingImage::draw(DrawingContext& context)
35 context.push_transform();
36 context.set_translation(Vector(0, 0));
38 Vector spos = pos + get_anchor_pos(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
39 sprite->get_width(), sprite->get_height(), anchor);
41 sprite->draw(context, spos, layer);
43 context.pop_transform();