supertux
title_screen.hpp
1 // SuperTux
2 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
3 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 // 2023 Vankata453
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_TITLE_SCREEN_HPP
20 #define HEADER_SUPERTUX_SUPERTUX_TITLE_SCREEN_HPP
21 
22 #include "supertux/screen.hpp"
23 #include "util/currenton.hpp"
24 
25 #include <string>
26 
27 #include "control/codecontroller.hpp"
28 #include "supertux/fadetoblack.hpp"
29 #include "video/surface_ptr.hpp"
30 
31 class GameSession;
32 class Savegame;
33 class Sector;
34 
37 class TitleScreen final : public Screen,
38  public Currenton<TitleScreen>
39 {
40 public:
41  TitleScreen(Savegame& savegame, bool christmas = false);
42  ~TitleScreen() override = default;
43 
44  void setup() override;
45  void leave() override;
46 
47  void draw(Compositor& compositor) override;
48  void update(float dt_sec, const Controller& controller) override;
49 
50  IntegrationStatus get_status() const override;
51 
52  void refresh_level();
53  void refresh_copyright_text();
54 
55  void set_frame(const std::string& image);
56 
57 private:
58  void setup_sector(Sector& sector);
59  void update_level(float dt_sec);
60 
61 private:
62  Savegame& m_savegame;
63  const bool m_christmas;
64 
65  SurfacePtr m_logo;
66  SurfacePtr m_santahat;
67  SurfacePtr m_frame;
68 
69  std::unique_ptr<CodeController> m_controller;
70  std::unique_ptr<GameSession> m_titlesession;
71 
72  std::string m_copyright_text;
73  std::string m_videosystem_name;
74 
75  bool m_jump_was_released;
76 
77 private:
78  TitleScreen(const TitleScreen&) = delete;
79  TitleScreen& operator=(const TitleScreen&) = delete;
80 };
81 
82 #endif
83 
84 /* EOF */
Definition: controller.hpp:57
Abstract base class for code the MainLoop runs exclusively and full-screen.
Definition: screen.hpp:31
IntegrationStatus get_status() const override
Gives details about what the user is doing right now.
Definition: title_screen.cpp:281
void draw(Compositor &compositor) override
gets called once per frame.
Definition: title_screen.cpp:162
Represents one of (potentially) multiple, separate parts of a Level.
Definition: sector.hpp:61
A &#39;Currenton&#39; allows access to the currently active instance of a class via the static current() func...
Definition: currenton.hpp:30
Definition: compositor.hpp:29
Definition: integration.hpp:26
Definition: savegame.hpp:69
void update(float dt_sec, const Controller &controller) override
gets called for once (per logical) frame.
Definition: title_screen.cpp:195
void refresh_level()
Definition: title_screen.cpp:80
Screen that displays the SuperTux logo, lets players start a new game, etc.
Definition: title_screen.hpp:37
void setup() override
gets called before this screen gets activated (which is at least once before the first draw or update...
Definition: title_screen.cpp:64
void leave() override
gets called when the current screen is temporarily suspended
Definition: title_screen.cpp:72
Screen that runs a Level, where Players run and jump through Sectors.
Definition: game_session.hpp:49