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_TILEMAP_HPP
18#define HEADER_SUPERTUX_SCRIPTING_TILEMAP_HPP
19
20#ifndef SCRIPTING_API
21#include "scripting/game_object.hpp"
22
23class TileMap;
24#endif
25
26namespace scripting {
27
28class TileMap final
29#ifndef SCRIPTING_API
30 : public GameObject<::TileMap>
31#endif
32{
33public:
34#ifndef SCRIPTING_API
35public:
36 using GameObject::GameObject;
37private:
38 TileMap(const TileMap&) = delete;
39 TileMap& operator=(const TileMap&) = delete;
40#endif
41
42public:
43 /** Move tilemap until at given node, then stop */
44 void goto_node(int node_no);
45
46 /** Start moving tilemap */
47 void start_moving();
48
49 /** Stop tilemap at next node */
50 void stop_moving();
51
52 /** returns tile ID in row y and column y (of the tilemap) */
53 int get_tile_id(int x, int y) const;
54
55 /** returns tile ID at position pos (in world coordinates) */
56 int get_tile_id_at(float x, float y) const;
57
58 /** replaces the tile by given tile in row y and column y (of the tilemap) */
59 void change(int x, int y, int newtile);
60
61 /** replaces the tile by given tile at position pos (in world coordinates) */
62 void change_at(float x, float y, int newtile);
63
64 /**
65 * Start fading the tilemap to opacity given by @c alpha.
66 * Destination opacity will be reached after @c seconds seconds. Also influences solidity.
67 */
68 void fade(float alpha, float seconds);
69
70 /**
71 * Start fading the tilemap to tint given by RGBA.
72 * Destination opacity will be reached after @c seconds seconds. Doesn't influence solidity.
73 */
74 void tint_fade(float seconds, float red, float green, float blue, float alpha);
75
76 /**
77 * Instantly switch tilemap's opacity to @c alpha. Also influences solidity.
78 */
79 void set_alpha(float alpha);
80
81 /**
82 * Return tilemap's opacity. Note that while the tilemap is fading in or out, this will return the current alpha value, not the target alpha.
83 */
84 float get_alpha() const;
85
86 /**
87 * Switch tilemap's real solidity to the given bool. Note that effective
88 * solidity is also influenced by the alpha of the tilemap.
89 */
90 void set_solid(bool solid); /**< true: make tilemap solid, false: disable solidity */
91};
92
93} // namespace scripting
94
95#endif
96
97/* EOF */
98