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 | #ifndef HEADER_SUPERTUX_SCRIPTING_FLOATING_IMAGE_HPP |
18 | #define |
19 | |
20 | #ifndef SCRIPTING_API |
21 | #include <memory> |
22 | |
23 | class FloatingImage; |
24 | |
25 | #include "scripting/game_object.hpp" |
26 | #endif |
27 | |
28 | namespace scripting { |
29 | |
30 | class FloatingImage final |
31 | #ifndef SCRIPTING_API |
32 | : public GameObject<::FloatingImage> |
33 | #endif |
34 | { |
35 | public: |
36 | FloatingImage(const std::string& spritefile); |
37 | |
38 | /** |
39 | * Sets the layer of the floating image |
40 | * @param layer Target layer |
41 | */ |
42 | void set_layer(int layer); |
43 | /** |
44 | * Returns the layer the floating image is on |
45 | */ |
46 | int get_layer() const; |
47 | /** |
48 | * Sets the location of the image, in relation to the current anchor point |
49 | * @param x X coordinate |
50 | * @param y Y coordinate |
51 | */ |
52 | void set_pos(float x, float y); |
53 | /** |
54 | * Returns the image's X coordinate relative to the current anchor point |
55 | */ |
56 | float get_pos_x() const; |
57 | /** |
58 | * Returns the image's Y coordinate relative to the current anchor point |
59 | */ |
60 | float get_pos_y() const; |
61 | /** |
62 | * Sets the image's anchor point |
63 | * @param anchor Anchor point as represented by the ANCHOR_* constants |
64 | */ |
65 | void set_anchor_point(int anchor); |
66 | /** |
67 | * Returns the current anchor point |
68 | */ |
69 | int get_anchor_point() const; |
70 | /** |
71 | * Sets the visibility of the floating image |
72 | * @param visible Visibility |
73 | */ |
74 | void set_visible(bool visible); |
75 | /** |
76 | * Returns the visibility state of the floating image |
77 | */ |
78 | bool get_visible() const; |
79 | /** |
80 | * Sets the action of the image |
81 | * This is only useful when the image is a sprite |
82 | * @param action Name of the action, as defined in the sprite |
83 | */ |
84 | void set_action(const std::string& action); |
85 | /** |
86 | * Returns the action of the image |
87 | * This is only useful when the image is a sprite |
88 | * @return Name of the action, as defined in the sprite |
89 | */ |
90 | std::string get_action() const; |
91 | void fade_in(float fadetime); |
92 | void fade_out(float fadetime); |
93 | |
94 | #ifndef SCRIPTING_API |
95 | private: |
96 | FloatingImage(const FloatingImage&) = delete; |
97 | FloatingImage& operator=(const FloatingImage&) = delete; |
98 | #endif |
99 | }; |
100 | |
101 | } // namespace scripting |
102 | |
103 | #endif |
104 | |
105 | /* EOF */ |
106 | |