The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
end_credits.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 - 2025
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#include <SDL3/SDL_keycode.h>
20#include <vector>
21
22
23namespace gui2
24{
25
26class scroll_label;
27
28namespace dialogs
29{
30
32{
33public:
34 explicit end_credits(const std::string& campaign = "");
35
37
38 /** TLD override to update animations, called once per frame */
39 virtual void update() override;
40
41private:
42 virtual const std::string& window_id() const override;
43
44 virtual void pre_show() override;
45
46 void key_press_callback(const SDL_Keycode key);
47
48 const std::string& focus_on_;
49
50 std::vector<std::string> backgrounds_;
51
53
54 // The speed of auto-scrolling, specified as px/s
56
57 uint32_t last_scroll_;
58
59 /**
60 * sliding_size_ alters how many of the sliding contents are to be run at once
61 * n-1 = 2 => 3 strings at once concatinated
62 */
63 static constexpr std::size_t sliding_size_ = 2;
64 /**
65 * number of lines to put in each chunk of text to display
66 * the final chunk will of course probably have fewer lines
67 */
68 static constexpr std::size_t lines_per_chunk_ = 50;
69 std::size_t first_idx_;
70 std::size_t last_idx_;
71 std::string content_;
72 std::string sliding_content_;
73 std::vector<std::vector<std::string>> chunks_;
74};
75
76} // namespace dialogs
77} // namespace gui2
virtual void pre_show() override
Actions to be taken before showing the window.
std::vector< std::string > backgrounds_
static constexpr std::size_t lines_per_chunk_
number of lines to put in each chunk of text to display the final chunk will of course probably have ...
const std::string & focus_on_
void key_press_callback(const SDL_Keycode key)
std::vector< std::vector< std::string > > chunks_
virtual const std::string & window_id() const override
The ID of the window to build.
static constexpr std::size_t sliding_size_
sliding_size_ alters how many of the sliding contents are to be run at once n-1 = 2 => 3 strings at o...
virtual void update() override
TLD override to update animations, called once per frame.
Abstract base class for all modal dialogs.
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
Various uncategorised dialogs.
Generic file dialog.