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
25class DrawingContext;
26class Level;
27class PlayerStatus;
28class Statistics;
29
30/** Screen that welcomes the player to a level */
31class LevelIntro final : public Screen
32{
33private:
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
39public:
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
47private:
48 void draw_stats_line(DrawingContext& context, int& py, const std::string& name, const std::string& stat);
49
50private:
51 const Level& m_level; /**< The level of which this is the intro screen */
52 const Statistics* m_best_level_statistics; /**< Best level statistics of the level of which is the intro screen */
53 SpritePtr m_player_sprite; /**< Sprite representing the player */
54 SpritePtr m_power_sprite;
55 float m_player_sprite_py; /**< Position (y axis) for the player sprite */
56 float m_player_sprite_vy; /**< Velocity (y axis) for the player sprite */
57 Timer m_player_sprite_jump_timer; /**< When timer fires, the player sprite will "jump" */
58 const PlayerStatus& m_player_status; /**The player status passed from GameSession*/
59
60private:
61 LevelIntro(const LevelIntro&) = delete;
62 LevelIntro& operator=(const LevelIntro&) = delete;
63};
64
65#endif
66
67/* EOF */
68