hopefully fixed the crash on exit, keep sectors script bundled in the sector and...
[supertux.git] / src / scripting / floating_image.cpp
1 #include <config.h>
2
3 #include "floating_image.hpp"
4 #include "sector.hpp"
5 #include "object/floating_image.hpp"
6
7 namespace Scripting
8 {
9
10 FloatingImage::FloatingImage(const std::string& spritefile)
11 {
12   assert(Sector::current() != NULL);
13   floating_image = new _FloatingImage(spritefile); 
14   Sector::current()->add_object(floating_image);
15 }
16
17 FloatingImage::~FloatingImage()
18 {
19   floating_image->remove_me();
20   // no delete here, Sector will do that
21 }
22
23 void
24 FloatingImage::set_layer(int layer)
25 {
26   floating_image->set_layer(layer);
27 }
28
29 int
30 FloatingImage::get_layer()
31 {
32   return floating_image->get_layer();
33 }
34
35 void
36 FloatingImage::set_pos(float x, float y)
37 {
38   floating_image->set_pos(Vector(x, y));
39 }
40
41 float
42 FloatingImage::get_pos_x()
43 {
44   return floating_image->get_pos().x;
45 }
46
47 float
48 FloatingImage::get_pos_y()
49 {
50   return floating_image->get_pos().y;
51 }
52
53 void
54 FloatingImage::set_anchor_point(int anchor)
55 {
56   floating_image->set_anchor_point((AnchorPoint) anchor);
57 }
58
59 int
60 FloatingImage::get_anchor_point()
61 {
62   return (int) floating_image->get_anchor_point();
63 }
64
65 bool
66 FloatingImage::get_visible()
67 {
68   return floating_image->get_visible();
69 }
70
71 void
72 FloatingImage::set_visible(bool visible)
73 {
74   floating_image->set_visible(visible);
75 }
76
77 }