1// SuperTux
2// Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17#include <stdexcept>
18
19#include "object/floating_image.hpp"
20#include "scripting/floating_image.hpp"
21#include "supertux/sector.hpp"
22#include "worldmap/worldmap.hpp"
23
24namespace scripting {
25
26FloatingImage::FloatingImage(const std::string& spritefile) :
27 GameObject(get_game_object_manager().add<::FloatingImage>(spritefile).get_uid())
28{
29}
30
31void
32FloatingImage::set_layer(int layer)
33{
34 SCRIPT_GUARD_VOID;
35 object.set_layer(layer);
36}
37
38int
39FloatingImage::get_layer() const
40{
41 SCRIPT_GUARD_DEFAULT;
42 return object.get_layer();
43}
44
45void
46FloatingImage::set_pos(float x, float y)
47{
48 SCRIPT_GUARD_VOID;
49 object.set_pos(Vector(x, y));
50}
51
52float
53FloatingImage::get_pos_x() const
54{
55 SCRIPT_GUARD_DEFAULT;
56 return object.get_pos().x;
57}
58
59float
60FloatingImage::get_pos_y() const
61{
62 SCRIPT_GUARD_DEFAULT;
63 return object.get_pos().y;
64}
65
66void
67FloatingImage::set_anchor_point(int anchor)
68{
69 SCRIPT_GUARD_VOID;
70 object.set_anchor_point(static_cast<AnchorPoint>(anchor));
71}
72
73int
74FloatingImage::get_anchor_point() const
75{
76 SCRIPT_GUARD_DEFAULT;
77 return static_cast<int>(object.get_anchor_point());
78}
79
80bool
81FloatingImage::get_visible() const
82{
83 SCRIPT_GUARD_DEFAULT;
84 return object.get_visible();
85}
86
87void
88FloatingImage::set_visible(bool visible)
89{
90 SCRIPT_GUARD_VOID;
91 object.set_visible(visible);
92}
93
94void
95FloatingImage::set_action(const std::string& action)
96{
97 SCRIPT_GUARD_VOID;
98 object.set_action(action);
99}
100
101std::string
102FloatingImage::get_action() const
103{
104 SCRIPT_GUARD_DEFAULT;
105 return object.get_action();
106}
107
108void
109FloatingImage::fade_in(float fadetime)
110{
111 SCRIPT_GUARD_VOID;
112 object.fade_in(fadetime);
113}
114
115void
116FloatingImage::fade_out(float fadetime)
117{
118 SCRIPT_GUARD_VOID;
119 object.fade_out(fadetime);
120}
121
122} // scripting
123
124/* EOF */
125