supertux
spotlight.hpp
1 // SuperTux
2 // Copyright (C) 2006 Matthias Braun <matze@braunis.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_SPOTLIGHT_HPP
18 #define HEADER_SUPERTUX_OBJECT_SPOTLIGHT_HPP
19 
20 #include "sprite/sprite_ptr.hpp"
21 #include "supertux/moving_object.hpp"
22 #include "video/color.hpp"
23 
24 class ReaderMapping;
25 
26 class Spotlight final : public MovingObject
27 {
28 public:
29  Spotlight(const ReaderMapping& reader);
30  virtual ~Spotlight();
31 
32  virtual void update(float dt_sec) override;
33  virtual void draw(DrawingContext& context) override;
34 
35  virtual HitResponse collision(GameObject& other, const CollisionHit& hit_) override;
36 
37  virtual std::string get_class() const override { return "spotlight"; }
38  virtual std::string get_display_name() const override { return _("Spotlight"); }
39 
40  virtual ObjectSettings get_settings() override;
41 
42 private:
43  float angle;
44  SpritePtr center;
45  SpritePtr base;
46  SpritePtr lights;
47  SpritePtr light;
48  SpritePtr lightcone;
49 
50  Color color;
51 
53  float speed;
54 
56  bool counter_clockwise;
57 
58 private:
59  Spotlight(const Spotlight&) = delete;
60  Spotlight& operator=(const Spotlight&) = delete;
61 };
62 
63 #endif
64 
65 /* EOF */
virtual HitResponse collision(GameObject &other, const CollisionHit &hit_) override
this function is called when the object collided with any other object
Definition: spotlight.cpp:106
Definition: object_settings.hpp:35
Definition: spotlight.hpp:26
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: spotlight.cpp:70
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: spotlight.cpp:83
Definition: color.hpp:25
Definition: reader_mapping.hpp:31
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