16 #define GETTEXT_DOMAIN "wesnoth-lib"
33 const unsigned FADE_DURATION_MS = 500;
46 , duration_(
info.end_text_duration)
52 if(!
info.end_text.empty()) {
53 text_.push_back(
info.end_text);
55 text_.push_back(
_(
"The End"));
58 if(
info.end_credits) {
59 text_.push_back(
"<span size='large'>" +
info.campaign_name +
"</span>");
62 for(
const auto&
about : (*campaign_credits)->sections) {
63 if(
about.names.empty()) {
68 static const float chunk_size = 5.0;
70 const unsigned num_names =
about.names.size();
71 const unsigned num_chunks = std::ceil(num_names / chunk_size);
73 for(std::size_t
i = 0;
i < num_chunks; ++
i) {
78 ss <<
about.title <<
"\n\n";
81 for(std::size_t k =
i * chunk_size; k < std::min<unsigned>((
i + 1) * chunk_size, num_names); ++k) {
82 ss <<
"<span size='xx-small'>" <<
about.names[k].first <<
"</span>\n";
86 std::string section_text = ss.str();
87 section_text.pop_back();
89 text_.push_back(std::move(section_text));
95 current_text_ = text_[0];
159 auto current_ticks = SDL_GetTicks();
169 std::round(255.0 *
double(current_ticks -
fade_start_) /
double(FADE_DURATION_MS)),
A simple canvas which can be drawn upon.
void set_variable(const std::string &key, wfl::variant &&value)
void update_size_variables()
Update WFL size variables.
Abstract base class for all modal dialogs.
Dialog to display 'The End' at the end of a campaign.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
virtual void update() override
Displays a simple fading screen with any user-provided text.
std::string current_text_
std::vector< std::string > text_
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
base class of top level items, the only item which needs to store the final canvases to draw on.
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.
void close()
Requests to close the window.
static std::string _(const char *str)
Display credits about all contributors.
utils::optional< credits_data::const_iterator > get_campaign_credits(const std::string &campaign)
Gets credits for a given campaign.
REGISTER_DIALOG(editor_edit_unit)
std::size_t add_timer(const uint32_t interval, const std::function< void(std::size_t id)> &callback, const bool repeat)
Adds a new timer.
bool remove_timer(const std::size_t id)
Removes a timer.
Contains the gui2 timer routines.