mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-30 13:05:45 +00:00
add option to disable loadinscreen animation
this was made for people to test whether bugs are related to loadingscreen animation or not.
This commit is contained in:
parent
e6eec06cb7
commit
2ac59d28ac
@ -29,6 +29,7 @@
|
||||
#include "cursor.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences.hpp"
|
||||
#include "utils/functional.hpp"
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
@ -103,7 +104,9 @@ twindow* tloadscreen::build_window(CVideo& video) const
|
||||
|
||||
void tloadscreen::pre_show(twindow& window)
|
||||
{
|
||||
worker_.reset(new boost::thread(work_));
|
||||
if (work_) {
|
||||
worker_.reset(new boost::thread(work_));
|
||||
}
|
||||
timer_id_ = add_timer(100, std::bind(&tloadscreen::timer_callback, this, std::ref(window)), true);
|
||||
cursor_setter_.reset(new cursor::setter(cursor::WAIT));
|
||||
progress_stage_label_ = &find_widget<tlabel>(&window, "status", false);
|
||||
@ -139,9 +142,12 @@ tloadscreen* tloadscreen::current_load = nullptr;
|
||||
|
||||
void tloadscreen::timer_callback(twindow& window)
|
||||
{
|
||||
if (!worker_ || worker_->timed_join(boost::posix_time::milliseconds(0))) {
|
||||
if (!work_ || !worker_ || worker_->timed_join(boost::posix_time::milliseconds(0))) {
|
||||
window.close();
|
||||
}
|
||||
if (!work_) {
|
||||
return;
|
||||
}
|
||||
const char* stage = current_stage_
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
;
|
||||
@ -172,12 +178,17 @@ tloadscreen::~tloadscreen()
|
||||
|
||||
void tloadscreen::display(CVideo& video, std::function<void()> f)
|
||||
{
|
||||
const bool use_loadingscreen_animation = !preferences::disable_loadingscreen_animation();
|
||||
if (current_load || video.faked()) {
|
||||
f();
|
||||
}
|
||||
else {
|
||||
else if(use_loadingscreen_animation) {
|
||||
tloadscreen(f).show(video);
|
||||
}
|
||||
else {
|
||||
tloadscreen(std::function<void()>()).show(video);
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gui2
|
||||
|
@ -1027,5 +1027,15 @@ void set_disable_auto_moves(bool value)
|
||||
preferences::set("disable_auto_moves", value);
|
||||
}
|
||||
|
||||
bool disable_loadingscreen_animation()
|
||||
{
|
||||
return get("disable_loadingscreen_animation", false);
|
||||
}
|
||||
|
||||
void set_disable_loadingscreen_animation(bool value)
|
||||
{
|
||||
set("disable_loadingscreen_animation", value);
|
||||
}
|
||||
|
||||
} // end namespace preferences
|
||||
|
||||
|
@ -260,6 +260,9 @@ namespace preferences {
|
||||
bool disable_auto_moves();
|
||||
void set_disable_auto_moves(bool value);
|
||||
|
||||
bool disable_loadingscreen_animation();
|
||||
void set_disable_loadingscreen_animation(bool value);
|
||||
|
||||
} // end namespace preferences
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user