supertux
sprite_particle.hpp
1 // SuperTux
2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef HEADER_SUPERTUX_OBJECT_SPRITE_PARTICLE_HPP
19 #define HEADER_SUPERTUX_OBJECT_SPRITE_PARTICLE_HPP
20 
21 #include "math/anchor_point.hpp"
22 #include "sprite/sprite_ptr.hpp"
23 #include "supertux/game_object.hpp"
24 #include "video/color.hpp"
25 #include "video/drawing_context.hpp"
26 
27 class Player;
28 
29 class SpriteParticle final : public GameObject
30 {
31 public:
32  SpriteParticle(SpritePtr sprite, const std::string& action,
33  const Vector& position, AnchorPoint anchor,
34  const Vector& velocity, const Vector& acceleration,
35  int drawing_layer = LAYER_OBJECTS-1, bool notimeout = false, Color color = Color::WHITE);
36  SpriteParticle(const std::string& sprite_name, const std::string& action,
37  const Vector& position, AnchorPoint anchor,
38  const Vector& velocity, const Vector& acceleration,
39  int drawing_layer = LAYER_OBJECTS-1, bool notimeout = false, Color color = Color::WHITE);
40  virtual GameObjectClasses get_class_types() const override { return GameObject::get_class_types().add(typeid(SpriteParticle)); }
41  ~SpriteParticle() override;
42 
43 protected:
44  virtual void update(float dt_sec) override;
45  virtual void draw(DrawingContext& context) override;
46  virtual bool is_saveable() const override {
47  return false;
48  }
49 
50 private:
51  SpritePtr sprite;
52  Vector position;
53  Vector velocity;
54  Vector acceleration;
55  int drawing_layer;
56  SpritePtr lightsprite;
57  bool glow;
58  bool no_time_out;
59  Color color;
60 
61 private:
62  SpriteParticle(const SpriteParticle&) = delete;
63  SpriteParticle& operator=(const SpriteParticle&) = delete;
64 };
65 
66 #endif
67 
68 /* EOF */
Definition: sprite_particle.hpp:29
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: sprite_particle.hpp:40
virtual bool is_saveable() const override
Indicates if the object will be saved.
Definition: sprite_particle.hpp:46
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: sprite_particle.cpp:78
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
virtual GameObjectClasses get_class_types() const
List notable classes in inheritance hierarchy of class.
Definition: game_object.cpp:113
Definition: color.hpp:26
A helper structure to list all the type_indexes of the classes in the type hierarchy of a given class...
Definition: game_object.hpp:57
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: sprite_particle.cpp:100
This module contains methods controlling the player.
Definition: player.hpp:47
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42