supertux
levelintro.hpp
1 // SuperTux -- LevelIntro screen
2 // Copyright (C) 2008 Christoph Sommer <christoph.sommer@2008.expires.deltadevelopment.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_SUPERTUX_LEVELINTRO_HPP
18 #define HEADER_SUPERTUX_SUPERTUX_LEVELINTRO_HPP
19 
20 #include "sprite/sprite_ptr.hpp"
21 #include "supertux/screen.hpp"
22 #include "supertux/timer.hpp"
23 #include "video/color.hpp"
24 
25 class DrawingContext;
26 class Level;
27 class PlayerStatus;
28 class Statistics;
29 
31 class LevelIntro final : public Screen
32 {
33 private:
34  static Color s_header_color;
35  static Color s_author_color;
36  static Color s_stat_hdr_color;
37  static Color s_stat_color;
38 
39 public:
40  LevelIntro(const Level& level, const Statistics* best_level_statistics, const PlayerStatus& player_status);
41  virtual ~LevelIntro();
42 
43  virtual void setup() override;
44  virtual void draw(Compositor& compositor) override;
45  virtual void update(float dt_sec, const Controller& controller) override;
46 
47 private:
48  void draw_stats_line(DrawingContext& context, int& py, const std::string& name, const std::string& stat);
49 
50 private:
51  const Level& m_level;
52  const Statistics* m_best_level_statistics;
53  SpritePtr m_player_sprite;
54  SpritePtr m_power_sprite;
55  float m_player_sprite_py;
56  float m_player_sprite_vy;
57  Timer m_player_sprite_jump_timer;
58  const PlayerStatus& m_player_status;
60 private:
61  LevelIntro(const LevelIntro&) = delete;
62  LevelIntro& operator=(const LevelIntro&) = delete;
63 };
64 
65 #endif
66 
67 /* EOF */
This class keeps player status between different game sessions (for example when switching maps in th...
Definition: player_status.hpp:38
virtual void setup() override
gets called before this screen gets activated (which is at least once before the first draw or update...
Definition: levelintro.cpp:69
Definition: controller.hpp:56
Screen that welcomes the player to a level.
Definition: levelintro.hpp:31
Abstract base class for code the MainLoop runs exclusively and full-screen.
Definition: screen.hpp:29
This class is a layer between level and worldmap to keep track of stuff like scores, and minor, but funny things, like number of jumps and stuff.
Definition: statistics.hpp:32
Represents a collection of Sectors running in a single GameSession.
Definition: level.hpp:29
Definition: compositor.hpp:29
virtual void draw(Compositor &compositor) override
gets called once per frame.
Definition: levelintro.cpp:118
virtual void update(float dt_sec, const Controller &controller) override
gets called for once (per logical) frame.
Definition: levelintro.cpp:74
Definition: color.hpp:25
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42