19 #define GETTEXT_DOMAIN "wesnoth-lib"
34 #include <boost/thread.hpp>
37 #define ERR_LS LOG_STREAM(err, log_loadscreen)
38 #define WRN_LS LOG_STREAM(warn, log_loadscreen)
39 #define LOG_LS LOG_STREAM(info, log_loadscreen)
40 #define DBG_LS LOG_STREAM(debug, log_loadscreen)
42 static const std::map<std::string, std::string>
stages =
44 {
"build terrain",
N_(
"Building terrain rules") },
45 {
"create cache",
N_(
"Reading files and creating cache") },
46 {
"init display",
N_(
"Initializing display") },
47 {
"init fonts",
N_(
"Reinitialize fonts for the current language") },
48 {
"init teams",
N_(
"Initializing teams") },
49 {
"init theme",
N_(
"Initializing display") },
50 {
"load config",
N_(
"Loading game configuration") },
51 {
"load data",
N_(
"Loading data files") },
52 {
"load level",
N_(
"Loading level") },
53 {
"init lua",
N_(
"Initializing scripting engine") },
54 {
"init whiteboard",
N_(
"Initializing planning mode") },
55 {
"load unit types",
N_(
"Reading unit files") },
56 {
"load units",
N_(
"Loading units") },
57 {
"refresh addons",
N_(
"Searching for installed add-ons") },
58 {
"start game",
N_(
"Starting game") },
59 {
"verify cache",
N_(
"Verifying cache") },
70 , animation_counter_(0)
74 , progress_stage_label_(
nullptr)
75 , animation_label_(
nullptr)
76 , current_stage_(
nullptr)
79 , current_visible_stage_()
81 for (
const auto& pair : stages) {
82 visible_stages_[pair.first] =
t_string(pair.second,
"wesnoth-lib") +
"...";
84 for (
int i = 0;
i != 20; ++
i) {
87 animation_stages_.push_back(s);
89 current_visible_stage_ = visible_stages_.end();
117 window.set_enter_disabled(
true);
118 window.set_escape_disabled(
true);
135 #if defined(_MSC_VER) && _MSC_VER < 1900
138 .store(stage, std::memory_order_release);
154 #if defined(_MSC_VER) && _MSC_VER < 1900
157 .load(std::memory_order_acquire);
163 WRN_LS <<
"Stage ID '" << stage <<
"' missing description." << std::endl;
187 else if(use_loadingscreen_animation) {
tloadscreen(std::function< void()> f)
twindow * build_window(CVideo &video) const
void pre_show(twindow &window)
Inherited from tdialog.
twindow * build(CVideo &video, const twindow_builder::tresolution *definition)
Builds a window.
tlabel * animation_label_
REGISTER_DIALOG(label_settings)
virtual void set_label(const t_string &label)
bool remove_timer(const size_t id)
Removes a timer.
void undraw()
Undraws the window.
std::map< std::string, t_string > visible_stages_
base class of top level items, the only item which needs to store the final canvases to draw on ...
A class inherited from ttext_box that displays its input as stars.
tlabel * progress_stage_label_
void timer_callback(twindow &window)
static tloadscreen * current_load
boost::scoped_ptr< cursor::setter > cursor_setter_
void close()
Requests to close the window.
static void display(CVideo &video, std::function< void()> f)
static void progress(const char *stage_name=nullptr)
std::atomic< const char * > current_stage_
Contains the gui2 timer routines.
std::map< std::string, t_string >::const_iterator current_visible_stage_
void post_show(twindow &window)
Inherited from tdialog.
bool disable_loadingscreen_animation()
Standard logging facilities (interface).
boost::scoped_ptr< boost::thread > worker_
virtual const std::string & window_id() const
The id of the window to build.
size_t add_timer(const Uint32 interval, const std::function< void(size_t id)> &callback, const bool repeat)
Adds a new timer.
std::function< void()> work_
void close()
Hides the window.
GLsizei const GLcharARB ** string
std::vector< t_string > animation_stages_
static lg::log_domain log_loadscreen("loadscreen")