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  static Color s_stat_perfect_color;
39 
40 public:
41  LevelIntro(const Level& level, const Statistics* best_level_statistics, const PlayerStatus& player_status);
42  ~LevelIntro() override;
43 
44  virtual void setup() override;
45  virtual void draw(Compositor& compositor) override;
46  virtual void update(float dt_sec, const Controller& controller) override;
47  virtual IntegrationStatus get_status() const override;
48 
49 private:
50  void draw_stats_line(DrawingContext& context, int& py, const std::string& name, const std::string& stat, bool isPerfect);
51  void push_player();
52  void pop_player();
53 
54 private:
55  const Level& m_level;
56  const Statistics* m_best_level_statistics;
57  std::vector<SpritePtr> m_player_sprite;
58  std::vector<SpritePtr> m_santa_sprite;
59  std::vector<float> m_player_sprite_py;
60  std::vector<float> m_player_sprite_vy;
61  std::vector<std::unique_ptr<Timer>> m_player_sprite_jump_timer;
62  const PlayerStatus& m_player_status;
64 private:
65  LevelIntro(const LevelIntro&) = delete;
66  LevelIntro& operator=(const LevelIntro&) = delete;
67 };
68 
69 #endif
70 
71 /* EOF */
This class keeps player status between different game sessions (for example when switching maps in th...
Definition: player_status.hpp:39
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:60
Definition: controller.hpp:57
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:31
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:36
virtual IntegrationStatus get_status() const override
Gives details about what the user is doing right now.
Definition: levelintro.cpp:208
Represents a collection of Sectors running in a single GameSession.
Definition: level.hpp:30
Definition: compositor.hpp:29
virtual void draw(Compositor &compositor) override
gets called once per frame.
Definition: levelintro.cpp:120
Definition: integration.hpp:26
virtual void update(float dt_sec, const Controller &controller) override
gets called for once (per logical) frame.
Definition: levelintro.cpp:65
Definition: color.hpp:26
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42