make igloo the first level
[supertux.git] / src / scripting / floating_image.cpp
1 //  $Id$
2 //
3 //  SuperTux
4 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 //
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20 #include <config.h>
21
22 #include <assert.h>
23 #include "floating_image.hpp"
24 #include "sector.hpp"
25 #include "object/floating_image.hpp"
26
27 namespace Scripting
28 {
29
30 FloatingImage::FloatingImage(const std::string& spritefile)
31 {
32   assert(Sector::current() != NULL);
33   floating_image = new _FloatingImage(spritefile); 
34   Sector::current()->add_object(floating_image);
35 }
36
37 FloatingImage::~FloatingImage()
38 {
39   floating_image->remove_me();
40   // no delete here, Sector will do that
41 }
42
43 void
44 FloatingImage::set_layer(int layer)
45 {
46   floating_image->set_layer(layer);
47 }
48
49 int
50 FloatingImage::get_layer()
51 {
52   return floating_image->get_layer();
53 }
54
55 void
56 FloatingImage::set_pos(float x, float y)
57 {
58   floating_image->set_pos(Vector(x, y));
59 }
60
61 float
62 FloatingImage::get_pos_x()
63 {
64   return floating_image->get_pos().x;
65 }
66
67 float
68 FloatingImage::get_pos_y()
69 {
70   return floating_image->get_pos().y;
71 }
72
73 void
74 FloatingImage::set_anchor_point(int anchor)
75 {
76   floating_image->set_anchor_point((AnchorPoint) anchor);
77 }
78
79 int
80 FloatingImage::get_anchor_point()
81 {
82   return (int) floating_image->get_anchor_point();
83 }
84
85 bool
86 FloatingImage::get_visible()
87 {
88   return floating_image->get_visible();
89 }
90
91 void
92 FloatingImage::set_visible(bool visible)
93 {
94   floating_image->set_visible(visible);
95 }
96
97 void
98 FloatingImage::set_action(const std::string& action)
99 {
100   floating_image->set_action(action);
101 }
102
103 std::string
104 FloatingImage::get_action()
105 {
106   return floating_image->get_action();
107 }
108
109 }