Renamed namespaces to all lowercase
[supertux.git] / src / worldmap / sprite_change.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_WORLDMAP_SPRITE_CHANGE_HPP
18 #define HEADER_SUPERTUX_WORLDMAP_SPRITE_CHANGE_HPP
19
20 #include <list>
21 #include <memory>
22 #include <string>
23
24 #include "util/reader_fwd.hpp"
25 #include "math/vector.hpp"
26 #include "supertux/game_object.hpp"
27
28 class Sprite;
29
30 namespace worldmap {
31
32 class SpriteChange : public GameObject
33 {
34 public:
35   SpriteChange(const Reader& lisp);
36   virtual ~SpriteChange();
37
38   virtual void draw(DrawingContext& context);
39   virtual void update(float elapsed_time);
40
41   /**
42    * Activates the SpriteChange's stay action, if applicable
43    */
44   void set_stay_action();
45
46   /**
47    * Deactivates the SpriteChange's stay action, if applicable
48    */
49   void clear_stay_action();
50
51 public:
52   Vector pos;
53
54   /** should tuxs sprite change when the tile has been completely entered,
55       or already when the tile was just touched */
56   bool change_on_touch;
57
58   /** sprite to change tux image to */
59   std::auto_ptr<Sprite> sprite;
60
61   /** stay action can be used for objects like boats or cars, if it is
62       != "" then this sprite will be displayed when tux left the tile
63       towards another SpriteChange object. */
64   std::string stay_action;
65
66   /** name of a group in which only one SpriteChange will ever have
67       its stay_action displayed.  Leave empty if you don't care. */
68   std::string stay_group;
69
70 private:
71   /** should the stayaction be displayed */
72   bool in_stay_action;
73
74 private:
75   static std::list<SpriteChange*> all_sprite_changes;
76 };
77
78 } // namespace worldmap
79
80 #endif
81
82 /* EOF */