42dcc2c097a70302909e8c612e8cea407b04b99f
[supertux.git] / src / object / light.cpp
1 #include <config.h>
2
3 #include "light.hpp"
4 #include "sprite/sprite_manager.hpp"
5 #include "resources.hpp"
6 #include "video/drawing_context.hpp"
7 #include "object_factory.hpp"
8 #include "player.hpp"
9 #include "sector.hpp"
10
11 Light::Light(const lisp::Lisp& )
12 {
13   sprite = sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite");
14 }
15
16 Light::~Light()
17 {
18   delete sprite;
19 }
20
21 void
22 Light::update(float )
23 {
24 }
25
26 void
27 Light::draw(DrawingContext& context)
28 {
29   context.push_target();
30   context.set_target(DrawingContext::LIGHTMAP);
31   
32   sprite->draw(context, Sector::current()->player->get_pos(), 0);
33   
34   context.pop_target();
35 }
36
37 IMPLEMENT_FACTORY(Light, "light");