20 #define GETTEXT_DOMAIN "wesnoth-lib"
37 #define LOG_LS LOG_STREAM(info, log_loadscreen)
38 #define ERR_LS LOG_STREAM(err, log_loadscreen)
39 #define WRN_LS LOG_STREAM(warn, log_loadscreen)
42 #define DBG_DP LOG_STREAM(debug, log_display)
44 static const std::map<loading_stage, std::string>
stage_names {
70 namespace {
int last_spin_ = 0; }
83 , progress_stage_label_(nullptr)
88 , current_visible_stage_()
91 for(
const auto& [stage, description] :
stage_names) {
137 int elapsed = SDL_GetTicks() - last_spin_;
139 last_spin_ = SDL_GetTicks();
165 LOG_LS <<
"Executing loading screen worker function.";
181 DBG_DP <<
"loading_screen::layout";
188 WRN_LS <<
"Stage missing description.";
196 using namespace std::chrono;
197 const auto now = steady_clock::now();
210 LOG_LS <<
"Loading screen destroyed.";
217 LOG_LS <<
"Directly executing loading function.";
220 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).
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()
REGISTER_DIALOG(tod_new_schedule)
bool headless()
The game is running headless.