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/drawing_context.hpp"
25 
26 class Player;
27 
28 class SpriteParticle final : public GameObject
29 {
30 public:
31  SpriteParticle(SpritePtr sprite, const std::string& action,
32  const Vector& position, AnchorPoint anchor,
33  const Vector& velocity, const Vector& acceleration,
34  int drawing_layer = LAYER_OBJECTS-1);
35  SpriteParticle(const std::string& sprite_name, const std::string& action,
36  const Vector& position, AnchorPoint anchor,
37  const Vector& velocity, const Vector& acceleration,
38  int drawing_layer = LAYER_OBJECTS-1);
39  ~SpriteParticle();
40 
41 protected:
42  virtual void update(float dt_sec) override;
43  virtual void draw(DrawingContext& context) override;
44  virtual bool is_saveable() const override {
45  return false;
46  }
47 
48 private:
49  SpritePtr sprite;
50  Vector position;
51  Vector velocity;
52  Vector acceleration;
53  int drawing_layer;
54  SpritePtr lightsprite;
55  bool glow;
56 
57 private:
58  SpriteParticle(const SpriteParticle&) = delete;
59  SpriteParticle& operator=(const SpriteParticle&) = delete;
60 };
61 
62 #endif
63 
64 /* EOF */
Simple two dimensional vector.
Definition: vector.hpp:24
Definition: sprite_particle.hpp:28
virtual bool is_saveable() const override
Indicates if the object will be saved.
Definition: sprite_particle.hpp:44
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:67
Base class for all the things that make up Levels&#39; Sectors.
Definition: game_object.hpp:46
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: sprite_particle.cpp:91
Definition: player.hpp:39
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42