supertux
lantern.hpp
1 // SuperTux - Lantern
2 // Copyright (C) 2006 Wolfgang Becker <uafr@gmx.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_LANTERN_HPP
18 #define HEADER_SUPERTUX_OBJECT_LANTERN_HPP
19 
20 #include "object/rock.hpp"
21 
23 class Lantern final : public Rock
24 {
25 public:
26  Lantern(const Vector& pos);
27  Lantern(const ReaderMapping& reader);
28 
29  virtual void draw(DrawingContext& context) override;
30 
31  virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
32 
33  virtual void grab(MovingObject& object, const Vector& pos, Direction dir) override;
34  virtual void ungrab(MovingObject& object, Direction dir) override;
35 
36  virtual std::string get_class() const override { return "lantern"; }
37  virtual std::string get_display_name() const override { return _("Lantern"); }
38 
39  virtual ObjectSettings get_settings() override;
40  virtual void after_editor_set() override;
41 
43  bool is_open() const;
44 
46  Color get_color() const { return lightcolor; }
47  void add_color(const Color& c);
48 
49 private:
50  Color lightcolor;
51  SpritePtr lightsprite;
52  void updateColor();
53 
54 private:
55  Lantern(const Lantern&) = delete;
56  Lantern& operator=(const Lantern&) = delete;
57 };
58 
59 #endif
60 
61 /* EOF */
Simple two dimensional vector.
Definition: vector.hpp:24
bool is_open() const
returns true if lamp is currently open
Definition: lantern.cpp:142
Lantern.
Definition: lantern.hpp:23
Definition: object_settings.hpp:35
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: lantern.cpp:89
Color get_color() const
returns the lamp&#39;s color
Definition: lantern.hpp:46
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 grab(MovingObject &object, const Vector &pos, Direction dir) override
called each frame when the object has been grabbed.
Definition: lantern.cpp:119
Definition: color.hpp:25
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
this function is called when the object collided with any other object
Definition: lantern.cpp:96
Definition: reader_mapping.hpp:31
Definition: rock.hpp:26
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