Removed Titlescreen Animation option and related code

This commit is contained in:
Charles Dang 2016-01-17 17:52:26 +11:00
parent db8c65aad8
commit 352bd1cae2
7 changed files with 7 additions and 117 deletions

View file

@ -55,13 +55,6 @@
default=yes
[/advanced_preference]
[advanced_preference]
field=startup_effect
name= _ "Show titlescreen animation"
type=boolean
default=no
[/advanced_preference]
[advanced_preference]
field=show_combat
name= _ "Show combat"

View file

@ -1,44 +0,0 @@
#textdomain wesnoth-lib
###
### Definition of an progress bar, used to fade in the logo in the title screen.
###
[progress_bar_definition]
id = "title_screen"
description = "A progress bar used in the title screen to fade in the logo."
[resolution]
# This maximum is also documented in the wiki
# http://wiki.wesnoth.org/ImageLocalization#BfW_Logo
min_width = 600
min_height = 250
default_width = 600
default_height = 250
max_width = 600
max_height = 250
[state_enabled]
[draw]
[image]
# w = 0 means fit
# using percentage = 0 seems to fail for some reason...
x = "((width - image_original_width) / 2)"
w = "(if(percentage <= 0, 1, (image_original_width * percentage) / 100))"
h = "(image_height)"
name = "misc/logo.png"
resize_mode = "tile"
[/image]
[/draw]
[/state_enabled]
[/resolution]
[/progress_bar_definition]

View file

@ -347,10 +347,10 @@
[column]
vertical_alignment = "top"
[progress_bar]
[image]
id = "logo"
definition = "title_screen"
[/progress_bar]
definition = "default"
[/image]
[/column]

View file

@ -1027,11 +1027,6 @@ compression::format save_compression_format()
return compression::GZIP;
}
bool startup_effect()
{
return preferences::get("startup_effect", false);
}
std::string get_chat_timestamp(const time_t& t) {
if (chat_timestamping()) {
if(preferences::use_twelve_hour_clock_format() == false) {

View file

@ -258,8 +258,6 @@ class acquaintance;
compression::format save_compression_format();
bool startup_effect();
std::set<std::string> &encountered_units();
std::set<t_translation::t_terrain> &encountered_terrains();

View file

@ -32,9 +32,9 @@
#include "gui/dialogs/tip.hpp"
#endif
#include "gui/widgets/button.hpp"
#include "gui/widgets/image.hpp"
#include "gui/widgets/label.hpp"
#include "gui/widgets/multi_page.hpp"
#include "gui/widgets/progress_bar.hpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/window.hpp"
#include "utils/foreach.tpp"
@ -132,41 +132,15 @@ static bool hotkey(twindow& window, const ttitle_screen::tresult result)
return true;
}
ttitle_screen::ttitle_screen() : logo_timer_id_(0), debug_clock_(NULL)
ttitle_screen::ttitle_screen() : debug_clock_(NULL)
{
}
ttitle_screen::~ttitle_screen()
{
if(logo_timer_id_) {
remove_timer(logo_timer_id_);
}
delete debug_clock_;
}
static void animate_logo(size_t& timer_id,
unsigned& percentage,
tprogress_bar& progress_bar,
twindow& window)
{
assert(percentage <= 100);
++percentage;
progress_bar.set_percentage(percentage);
/*
* The progress bar may overlap (actually underlap) other widgets, which
* the update invalidates, so make sure the whole window is redrawn to fix
* this possible problem. Of course this is expensive but the logo is
* animated once so the cost is only once.
*/
window.set_is_dirty(true);
if(percentage == 100) {
remove_timer(timer_id);
timer_id = 0;
}
}
static bool fullscreen(CVideo& video)
{
video.set_fullscreen(!preferences::fullscreen());
@ -374,31 +348,8 @@ void ttitle_screen::pre_show(CVideo& video, twindow& window)
variant(game_config::images::game_title_background));
}
/***** Set the logo *****/
tprogress_bar* logo
= find_widget<tprogress_bar>(&window, "logo", false, false);
if(logo) {
/*
* A 'singleton' value, since the progress bar only needs to progress
* once its state needs to be global.
*/
static unsigned percentage = preferences::startup_effect() ? 0 : 100;
logo->set_percentage(percentage);
if(percentage < 100) {
/*
* The interval is empirically determined so that the speed "felt"
* good.
*/
logo_timer_id_ = add_timer(30,
boost::bind(animate_logo,
boost::ref(logo_timer_id_),
boost::ref(percentage),
boost::ref(*logo),
boost::ref(window)),
true);
}
}
/***** Logo *****/
find_widget<timage>(&window, "logo", false).set_image("misc/logo.png");
/***** About dialog button *****/
tbutton& about = find_widget<tbutton>(&window, "about", false);

View file

@ -91,9 +91,6 @@ private:
/** Inherited from tdialog. */
void pre_show(CVideo& video, twindow& window);
/** The progress bar time for the logo. */
size_t logo_timer_id_;
/** Holds the debug clock dialog. */
tpopup* debug_clock_;