20 #define GETTEXT_DOMAIN "wesnoth-lib"
42 #define LOG_LS LOG_STREAM(info, log_loadscreen)
43 #define ERR_LS LOG_STREAM(err, log_loadscreen)
44 #define WRN_LS LOG_STREAM(warn, log_loadscreen)
47 #define DBG_DP LOG_STREAM(debug, log_display)
49 static const std::map<loading_stage, std::string>
stage_names {
75 namespace {
int last_spin_ = 0; }
88 , progress_stage_label_(nullptr)
93 , current_visible_stage_()
96 for(
const auto& [stage, description] :
stage_names) {
142 int elapsed = SDL_GetTicks() - last_spin_;
144 last_spin_ = SDL_GetTicks();
170 LOG_LS <<
"Executing loading screen worker function.";
186 DBG_DP <<
"loading_screen::layout";
193 WRN_LS <<
"Stage missing description.";
201 using namespace std::chrono;
202 const auto now = steady_clock::now();
215 LOG_LS <<
"Loading screen destroyed.";
222 LOG_LS <<
"Directly executing loading function.";
225 LOG_LS <<
"Creating new loading screen.";
void set_variable(const std::string &key, wfl::variant &&value)
static void progress(loading_stage stage=loading_stage::none)
Report what is being loaded to the loading screen.
std::optional< decltype(std::chrono::steady_clock::now())> animation_start_
virtual void layout() override
Called by draw_manager to assign concrete layout.
std::atomic< loading_stage > current_stage_
static loading_screen * singleton_
virtual void process(events::pump_info &) override
Inherited from events::pump_monitor.
label * progress_stage_label_
static void raise()
Raise the loading screen to the top of the draw stack.
stage_map visible_stages_
static void display(std::function< void()> f)
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
std::vector< std::function< void()> > load_funcs_
std::unique_ptr< cursor::setter > cursor_setter_
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
stage_map::const_iterator current_visible_stage_
loading_screen(std::function< void()> f)
static void spin()
Indicate to the player that loading is progressing.
Abstract base class for all modal dialogs.
canvas & get_drawing_canvas()
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.
virtual void layout() override
Lays out the window.
void set_escape_disabled(const bool escape_disabled)
Disable the escape key.
static lg::log_domain log_loadscreen("loadscreen")
static const std::map< loading_stage, std::string > stage_names
static lg::log_domain log_display("display")
loading_stage
Loading screen stage IDs.
Standard logging facilities (interface).
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
int get_frame_length()
Returns the length of one display frame, in milliseconds.
void raise_drawable(top_level_drawable *tld)
Raise a TLD to the top of the drawing stack.
void pump_and_draw()
pump() then immediately draw()
bool headless()
The game is running headless.
Contains the SDL_Rect helper code.
This file contains the settings handling of the widget library.
Contains the gui2 timer routines.