supertux
player_status_hud.hpp
1 // SuperTux
2 // Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
3 // 2006 Matthias Braun <matze@braunis.de>
4 // 2018 Ingo Ruhnke <grumbel@gmail.com>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef HEADER_SUPERTUX_SUPERTUX_PLAYER_STATUS_HUD_HPP
20 #define HEADER_SUPERTUX_SUPERTUX_PLAYER_STATUS_HUD_HPP
21 
22 #include "supertux/game_object.hpp"
23 
24 #include "video/color.hpp"
25 #include "video/surface_ptr.hpp"
26 
27 class DrawingContext;
28 class PlayerStatus;
29 
31 {
32 private:
33  static Color text_color;
34 
35 public:
36  PlayerStatusHUD(PlayerStatus& player_status);
37  virtual GameObjectClasses get_class_types() const override { return GameObject::get_class_types().add(typeid(PlayerStatusHUD)); }
38 
39  virtual void update(float dt_sec) override;
40  virtual void draw(DrawingContext& context) override;
41 
42  virtual bool is_saveable() const override { return false; }
43  virtual bool is_singleton() const override { return true; }
44 
45  void reset();
46 
47 private:
48  PlayerStatus& m_player_status;
49  int displayed_coins;
50  int displayed_coins_frame;
51  SurfacePtr coin_surface;
52  SurfacePtr fire_surface;
53  SurfacePtr ice_surface;
54 
55 private:
56  PlayerStatusHUD(const PlayerStatusHUD&) = delete;
57  PlayerStatusHUD& operator=(const PlayerStatusHUD&) = delete;
58 };
59 
60 #endif
61 
62 /* EOF */
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: player_status_hud.cpp:45
This class keeps player status between different game sessions (for example when switching maps in th...
Definition: player_status.hpp:39
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: player_status_hud.cpp:50
Definition: player_status_hud.hpp:30
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
virtual bool is_singleton() const override
If true only a single object of this type is allowed in a given GameObjectManager.
Definition: player_status_hud.hpp:43
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 GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: player_status_hud.hpp:37
virtual bool is_saveable() const override
Indicates if the object will be saved.
Definition: player_status_hud.hpp:42
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42