The Battle for Wesnoth  1.19.7+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 
20 #include <chrono>
21 
23 
24 namespace gui2::dialogs
25 {
26 /** Dialog to display 'The End' at the end of a campaign. */
27 class outro : public modal_dialog
28 {
29 public:
31 
32  /**
33  * Displays a simple fading screen with any user-provided text.
34  * Used after the end of single-player campaigns.
35  */
37 
38  /** TLD override to update animations, called once per frame */
39  virtual void update() override;
40 
41 private:
42  virtual const std::string& window_id() const override;
43 
44  virtual void pre_show() override;
45 
46  virtual void post_show() override;
47 
48  std::vector<std::string> text_;
49  std::string current_text_;
50  std::size_t text_index_;
51 
52  std::chrono::milliseconds duration_;
54  uint32_t fade_start_;
55 
56  bool fading_in_;
57 
58  std::size_t timer_id_;
59 };
60 
61 } // namespace dialogs
Abstract base class for all modal dialogs.
Dialog to display 'The End' at the end of a campaign.
Definition: outro.hpp:28
virtual void update() override
Displays a simple fading screen with any user-provided text.
Definition: outro.cpp:111
virtual void pre_show() override
Actions to be taken before showing the window.
Definition: outro.cpp:105
std::chrono::milliseconds duration_
Definition: outro.hpp:52
outro(const game_classification &info)
Definition: outro.cpp:44
std::size_t text_index_
Definition: outro.hpp:50
std::string current_text_
Definition: outro.hpp:49
virtual void post_show() override
Actions to be taken after the window has been shown.
Definition: outro.cpp:179
virtual const std::string & window_id() const override
The ID of the window to build.
std::vector< std::string > text_
Definition: outro.hpp:48
std::size_t timer_id_
Definition: outro.hpp:58
uint32_t fade_start_
Definition: outro.hpp:54
#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:319