levelintro.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef HEADER_SUPERTUX_SUPERTUX_LEVELINTRO_HPP
  17. #define HEADER_SUPERTUX_SUPERTUX_LEVELINTRO_HPP
  18. #include "sprite/sprite_ptr.hpp"
  19. #include "supertux/screen.hpp"
  20. #include "supertux/timer.hpp"
  21. #include "video/color.hpp"
  22. class DrawingContext;
  23. class Level;
  24. class PlayerStatus;
  25. class Statistics;
  26. /** Screen that welcomes the player to a level */
  27. class LevelIntro final : public Screen
  28. {
  29. private:
  30. static Color s_header_color;
  31. static Color s_author_color;
  32. static Color s_stat_hdr_color;
  33. static Color s_stat_color;
  34. static Color s_stat_perfect_color;
  35. public:
  36. LevelIntro(const Level& level, const Statistics* best_level_statistics, const PlayerStatus& player_status);
  37. ~LevelIntro() override;
  38. virtual void setup() override;
  39. virtual void draw(Compositor& compositor) override;
  40. virtual void update(float dt_sec, const Controller& controller) override;
  41. virtual IntegrationStatus get_status() const override;
  42. private:
  43. void draw_stats_line(DrawingContext& context, int& py, const std::string& name, const std::string& stat, bool isPerfect);
  44. void push_player();
  45. void pop_player();
  46. private:
  47. const Level& m_level; /**< The level of which this is the intro screen */
  48. const Statistics* m_best_level_statistics; /**< Best level statistics of the level of which is the intro screen */
  49. std::vector<SpritePtr> m_player_sprite; /**< Sprite representing the player */
  50. std::vector<SpritePtr> m_santa_sprite;
  51. std::vector<float> m_player_sprite_py; /**< Position (y axis) for the player sprite */
  52. std::vector<float> m_player_sprite_vy; /**< Velocity (y axis) for the player sprite */
  53. std::vector<std::unique_ptr<Timer>> m_player_sprite_jump_timer; /**< When timer fires, the player sprite will "jump" */
  54. const PlayerStatus& m_player_status; /**The player status passed from GameSession*/
  55. private:
  56. LevelIntro(const LevelIntro&) = delete;
  57. LevelIntro& operator=(const LevelIntro&) = delete;
  58. };
  59. #endif
  60. /* EOF */