The Battle for Wesnoth  1.19.0-dev
outro.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 - 2024
3  by Charles Dang <exodia339@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
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 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
21 
22 namespace gui2::dialogs
23 {
24 /** Dialog to display 'The End' at the end of a campaign. */
25 class outro : public modal_dialog
26 {
27 public:
29 
30  /**
31  * Displays a simple fading screen with any user-provided text.
32  * Used after the end of single-player campaigns.
33  *
34  * @param text Text to display, centered on the screen.
35  *
36  * @param duration In milliseconds, for how much time the text will
37  * be displayed on screen.
38  */
40 
41  /** TLD override to update animations, called once per frame */
42  virtual void update() override;
43 
44 private:
45  virtual const std::string& window_id() const override;
46 
47  virtual void pre_show(window& window) override;
48 
49  virtual void post_show(window& window) override;
50 
51  std::vector<std::string> text_;
52  std::string current_text_;
53  std::size_t text_index_;
54 
55  unsigned int duration_;
57  uint32_t fade_start_;
58 
59  bool fading_in_;
60 
61  std::size_t timer_id_;
62 };
63 
64 } // namespace dialogs
Abstract base class for all modal dialogs.
Dialog to display 'The End' at the end of a campaign.
Definition: outro.hpp:26
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
Definition: outro.cpp:176
virtual void update() override
Displays a simple fading screen with any user-provided text.
Definition: outro.cpp:108
unsigned int duration_
Definition: outro.hpp:55
outro(const game_classification &info)
Definition: outro.cpp:41
std::size_t text_index_
Definition: outro.hpp:53
std::string current_text_
Definition: outro.hpp:52
virtual const std::string & window_id() const override
The ID of the window to build.
std::vector< std::string > text_
Definition: outro.hpp:51
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
Definition: outro.cpp:102
std::size_t timer_id_
Definition: outro.hpp:61
uint32_t fade_start_
Definition: outro.hpp:57
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:61
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
logger & info()
Definition: log.cpp:314