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 
38  virtual void update(float dt_sec) override;
39  virtual void draw(DrawingContext& context) override;
40 
41  virtual bool is_saveable() const override { return false; }
42  virtual bool is_singleton() const override { return true; }
43 
44  void reset();
45 
46 private:
47  PlayerStatus& m_player_status;
48  int displayed_coins;
49  int displayed_coins_frame;
50  SurfacePtr coin_surface;
51 
52 private:
53  PlayerStatusHUD(const PlayerStatusHUD&) = delete;
54  PlayerStatusHUD& operator=(const PlayerStatusHUD&) = delete;
55 };
56 
57 #endif
58 
59 /* 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:44
This class keeps player status between different game sessions (for example when switching maps in th...
Definition: player_status.hpp:38
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:49
Definition: player_status_hud.hpp:30
Base class for all the things that make up Levels&#39; Sectors.
Definition: game_object.hpp:46
Definition: color.hpp:25
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:42
virtual bool is_saveable() const override
Indicates if the object will be saved.
Definition: player_status_hud.hpp:41
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42