diff --git a/data/gui/window/loadscreen.cfg b/data/gui/window/loadscreen.cfg index 8cb03f332f14..643b222184b1 100644 --- a/data/gui/window/loadscreen.cfg +++ b/data/gui/window/loadscreen.cfg @@ -115,6 +115,28 @@ [/row] + [row] + grow_factor = 0 + + [column] + grow_factor = 1 + border = "all" + border_size = 5 + horizontal_alignment = "center" + vertical_alignment = "center" + horizontal_grow = "true" + + [label] + text_alignment = "center" + definition = "default_large" + id = "test_animation" + label = "...................." + [/label] + + [/column] + + [/row] + [row] grow_factor = 1 diff --git a/src/gui/dialogs/loadscreen.cpp b/src/gui/dialogs/loadscreen.cpp index 1f80ed5286dc..05b82f994e30 100644 --- a/src/gui/dialogs/loadscreen.cpp +++ b/src/gui/dialogs/loadscreen.cpp @@ -33,6 +33,7 @@ REGISTER_DIALOG(loadscreen) tloadscreen::tloadscreen(boost::function f) : window_(NULL) , timer_id_(0) + , animation_counter_(0) , work_(f) , worker_() , cursor_setter_() @@ -78,6 +79,8 @@ void tloadscreen::pre_show(twindow& window) timer_id_ = add_timer(100, boost::bind(&tloadscreen::timer_callback, this, boost::ref(window)), true); cursor_setter_.reset(new cursor::setter(cursor::WAIT)); progress_stage_label_ = &find_widget(&window, "status", false); + animation_label_ = &find_widget(&window, "test_animation", false); + } void tloadscreen::post_show(twindow& /*window*/) @@ -109,7 +112,13 @@ void tloadscreen::timer_callback(twindow& window) { current_visible_stage_ = current_stage_; progress_stage_label_->set_label(current_visible_stage_); - + } + ++animation_counter_; + if (animation_counter_ % 2 == 0) { + int animation_state = (animation_counter_ / 2) % 20; + std::string s(20, ' '); + s[animation_state] = '.'; + animation_label_->set_label(s); } } diff --git a/src/gui/dialogs/loadscreen.hpp b/src/gui/dialogs/loadscreen.hpp index d344eaaa9203..4ade28c664c7 100644 --- a/src/gui/dialogs/loadscreen.hpp +++ b/src/gui/dialogs/loadscreen.hpp @@ -58,6 +58,7 @@ class tloadscreen : public tdialog private: twindow* window_; size_t timer_id_; + int animation_counter_; boost::function work_; boost::scoped_ptr worker_; boost::scoped_ptr cursor_setter_; @@ -75,6 +76,7 @@ class tloadscreen : public tdialog void post_show(twindow& window); tlabel* progress_stage_label_; + tlabel* animation_label_; static tloadscreen* current_load; //Note we cannot use std::strings here unless we we explicitly use mutexes.