supertux
thunderstorm.hpp
1 // SuperTux - Thunderstorm Game Object
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_THUNDERSTORM_HPP
18 #define HEADER_SUPERTUX_OBJECT_THUNDERSTORM_HPP
19 
20 #include "squirrel/exposed_object.hpp"
21 #include "scripting/thunderstorm.hpp"
22 #include "supertux/game_object.hpp"
23 #include "supertux/timer.hpp"
24 
25 class DrawingContext;
26 class ReaderMapping;
27 
30 class Thunderstorm final : public GameObject,
31  public ExposedObject<Thunderstorm, scripting::Thunderstorm>
32 {
33 public:
34  Thunderstorm(const ReaderMapping& reader);
35 
36  virtual void update(float dt_sec) override;
37  virtual void draw(DrawingContext& context) override;
38 
39  virtual std::string get_class() const override { return "thunderstorm"; }
40  virtual std::string get_display_name() const override { return _("Thunderstorm"); }
41 
42  virtual ObjectSettings get_settings() override;
43 
44  virtual const std::string get_icon_path() const override { return "images/engine/editor/thunderstorm.png"; }
45 
50  void start();
51 
53  void stop();
54 
56  void thunder();
57 
59  void lightning();
60 
62  void flash();
63 
65  void electrify();
66 
69 private:
70  bool running;
71  float interval;
72  int layer;
74  Timer time_to_thunder;
75  Timer time_to_lightning;
76  Timer flash_display_timer;
78 private:
79  Thunderstorm(const Thunderstorm&) = delete;
80  Thunderstorm& operator=(const Thunderstorm&) = delete;
81 };
82 
83 #endif
84 
85 /* EOF */
void stop()
Stop playing thunder and lightning at configured interval.
Definition: thunderstorm.cpp:118
This class binds a certain GameObject class to a scripting class.
Definition: exposed_object.hpp:45
void electrify()
Electrify water throughout the whole sector for a short time.
Definition: thunderstorm.cpp:147
Definition: object_settings.hpp:35
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: thunderstorm.cpp:78
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: thunderstorm.cpp:93
Base class for all the things that make up Levels&#39; Sectors.
Definition: game_object.hpp:46
void start()
Start playing thunder and lightning at configured interval.
Definition: thunderstorm.cpp:109
void lightning()
Play lightning, i.e.
Definition: thunderstorm.cpp:133
Thunderstorm scriptable GameObject; plays thunder, lightning and electrifies water at regular interva...
Definition: thunderstorm.hpp:30
void flash()
Display a nice flash.
Definition: thunderstorm.cpp:140
void thunder()
Play thunder.
Definition: thunderstorm.cpp:127
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
Definition: reader_mapping.hpp:31
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42