supertux
candle.hpp
1 // SuperTux
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_CANDLE_HPP
18 #define HEADER_SUPERTUX_OBJECT_CANDLE_HPP
19 
20 #include "object/moving_sprite.hpp"
21 #include "scripting/candle.hpp"
22 #include "squirrel/exposed_object.hpp"
23 
27 class Candle final : public MovingSprite,
28  public ExposedObject<Candle, scripting::Candle>
29 {
30 public:
31  Candle(const ReaderMapping& mapping);
32  virtual void draw(DrawingContext& context) override;
33 
34  virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
35  virtual std::string get_class() const override { return "candle"; }
36  virtual std::string get_display_name() const override { return _("Candle"); }
37 
38  virtual ObjectSettings get_settings() override;
39  virtual void after_editor_set() override;
40 
43  void puff_smoke();
44  bool get_burning() const;
45  void set_burning(bool burning);
48 private:
49  bool burning;
50  bool flicker;
51  Color lightcolor;
52  SpritePtr candle_light_1;
53  SpritePtr candle_light_2;
55 private:
56  Candle(const Candle&) = delete;
57  Candle& operator=(const Candle&) = delete;
58 };
59 
60 #endif
61 
62 /* EOF */
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: candle.cpp:84
void puff_smoke()
spawn a puff of smoke
Definition: candle.cpp:110
This class binds a certain GameObject class to a scripting class.
Definition: exposed_object.hpp:45
Definition: object_settings.hpp:35
A burning candle: Simple, scriptable level decoration.
Definition: candle.hpp:27
Base class for all the things that make up Levels&#39; Sectors.
Definition: game_object.hpp:46
bool get_burning() const
returns true if candle is lighted
Definition: candle.cpp:123
void set_burning(bool burning)
true: light candle, false: extinguish candle
Definition: candle.cpp:129
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
this function is called when the object collided with any other object
Definition: candle.cpp:104
Definition: color.hpp:25
Definition: reader_mapping.hpp:31
Abstract base class for MovingObjects that are represented by a Sprite.
Definition: moving_sprite.hpp:29
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