The Battle for Wesnoth  1.15.1+dev
outro.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017-2018 by Charles Dang <exodia339@gmail.com>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
18 
19 namespace gui2
20 {
21 namespace dialogs
22 {
23 
24 /** Dialog to display 'The End' at the end of a campaign. */
25 class outro : public modal_dialog
26 {
27 public:
28  outro(const std::string& text, unsigned int duration);
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 private:
42  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
43  virtual const std::string& window_id() const override;
44 
45  /** Inherited from modal_dialog. */
46  virtual void pre_show(window& window) override;
47 
48  /** Inherited from modal_dialog. */
49  virtual void post_show(window& window) override;
50 
51  void set_next_draw();
52 
53  void draw_callback(window& window);
54 
55  std::string text_;
56 
57  unsigned int duration_;
59 
60  bool fading_in_;
61 
62  std::size_t timer_id_;
63  std::size_t next_draw_;
64 };
65 
66 } // namespace dialogs
67 } // namespace gui2
std::size_t next_draw_
Definition: outro.hpp:63
unsigned int duration_
Definition: outro.hpp:57
std::size_t timer_id_
Definition: outro.hpp:62
Generic file dialog.
Definition: field-fwd.hpp:22
void set_next_draw()
Definition: outro.cpp:60
virtual const std::string & window_id() const override
Displays a simple fading screen with any user-provided text.
std::string text_
Definition: outro.hpp:55
Various uncategorised dialogs.
outro(const std::string &text, unsigned int duration)
Definition: outro.cpp:33
Dialog to display &#39;The End&#39; at the end of a campaign.
Definition: outro.hpp:25
Abstract base class for all modal dialogs.
void draw_callback(window &window)
Definition: outro.cpp:68
virtual void post_show(window &window) override
Inherited from modal_dialog.
Definition: outro.cpp:111
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Definition: outro.cpp:50