1 | // SuperTux - Wind |
2 | // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.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_OBJECT_WIND_HPP |
18 | #define |
19 | |
20 | #include "squirrel/exposed_object.hpp" |
21 | #include "scripting/wind.hpp" |
22 | #include "supertux/moving_object.hpp" |
23 | |
24 | class ReaderMapping; |
25 | |
26 | /** Defines an area that will gently push Players in one direction */ |
27 | class Wind final : |
28 | public MovingObject, |
29 | public ExposedObject<Wind, scripting::Wind> |
30 | { |
31 | public: |
32 | Wind(const ReaderMapping& reader); |
33 | |
34 | virtual void update(float dt_sec) override; |
35 | virtual void draw(DrawingContext& context) override; |
36 | virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override; |
37 | |
38 | virtual bool has_variable_size() const override { return true; } |
39 | virtual std::string get_class() const override { return "wind" ; } |
40 | virtual std::string get_display_name() const override { return _("Wind" );} |
41 | |
42 | virtual ObjectSettings get_settings() override; |
43 | |
44 | /** @name Scriptable Methods |
45 | @{ */ |
46 | |
47 | /** start blowing */ |
48 | void start(); |
49 | |
50 | /** stop blowing */ |
51 | void stop(); |
52 | |
53 | /** @} */ |
54 | |
55 | private: |
56 | bool blowing; /**< true if wind is currently switched on */ |
57 | Vector speed; |
58 | float acceleration; |
59 | Vector new_size; |
60 | |
61 | float dt_sec; /**< stores last dt_sec gotten at update() */ |
62 | |
63 | private: |
64 | Wind(const Wind&) = delete; |
65 | Wind& operator=(const Wind&) = delete; |
66 | }; |
67 | |
68 | #endif |
69 | |
70 | /* EOF */ |
71 | |