supertux
wind.hpp
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 HEADER_SUPERTUX_OBJECT_WIND_HPP
19 
20 #include "squirrel/exposed_object.hpp"
21 #include "scripting/wind.hpp"
22 #include "supertux/moving_object.hpp"
23 
24 class ReaderMapping;
25 
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 
48  void start();
49 
51  void stop();
52 
55 private:
56  bool blowing;
57  Vector speed;
58  float acceleration;
59  Vector new_size;
60 
61  float dt_sec;
63 private:
64  Wind(const Wind&) = delete;
65  Wind& operator=(const Wind&) = delete;
66 };
67 
68 #endif
69 
70 /* EOF */
Defines an area that will gently push Players in one direction.
Definition: wind.hpp:27
virtual bool has_variable_size() const override
Does this object have variable size (secret area trigger, wind, etc.)
Definition: wind.hpp:38
Simple two dimensional vector.
Definition: vector.hpp:24
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: wind.cpp:92
This class binds a certain GameObject class to a scripting class.
Definition: exposed_object.hpp:45
Definition: object_settings.hpp:35
void start()
start blowing
Definition: wind.cpp:116
Base class for all the things that make up Levels&#39; Sectors.
Definition: game_object.hpp:46
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:31
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it&#39;s state.
Definition: wind.cpp:74
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
this function is called when the object collided with any other object
Definition: wind.cpp:101
Definition: reader_mapping.hpp:31
void stop()
stop blowing
Definition: wind.cpp:122
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
This class collects data about a collision.
Definition: collision_hit.hpp:44