Implement new GUI2 loadscreen
This commit is contained in:
parent
60910506c6
commit
465f5eece1
20 changed files with 294 additions and 605 deletions
143
data/gui/window/loadscreen.cfg
Normal file
143
data/gui/window/loadscreen.cfg
Normal file
|
@ -0,0 +1,143 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of the loadscreen
|
||||
###
|
||||
|
||||
[window_definition]
|
||||
|
||||
id = "loadscreen"
|
||||
description = "The window definition for the loading screen."
|
||||
|
||||
[resolution]
|
||||
|
||||
[background]
|
||||
|
||||
[draw]
|
||||
|
||||
[rectangle]
|
||||
x = 0
|
||||
y = 0
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
|
||||
fill_color = "0, 0, 0, 255"
|
||||
[/rectangle]
|
||||
|
||||
[/draw]
|
||||
|
||||
[/background]
|
||||
|
||||
[foreground]
|
||||
|
||||
[draw]
|
||||
|
||||
[/draw]
|
||||
|
||||
[/foreground]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window_definition]
|
||||
|
||||
#define _GUI_PADDING
|
||||
[row]
|
||||
|
||||
[column]
|
||||
|
||||
[spacer]
|
||||
height = "(screen_height / 4)"
|
||||
[/spacer]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
#enddef
|
||||
|
||||
[window]
|
||||
id = "loadscreen"
|
||||
description = "Loadscreen."
|
||||
|
||||
[resolution]
|
||||
definition = "loadscreen"
|
||||
|
||||
{GUI_WINDOW_FULLSCREEN}
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
|
||||
{_GUI_PADDING}
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
vertical_alignment = "center"
|
||||
|
||||
[image]
|
||||
definition = "logo"
|
||||
label = "misc/logo-bg.png~BLIT(misc/logo.png)"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
vertical_alignment = "center"
|
||||
|
||||
[label]
|
||||
definition = "default_large"
|
||||
id = "status"
|
||||
label = _ "Loading..."
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
vertical_alignment = "center"
|
||||
|
||||
[image]
|
||||
definition = "decoration"
|
||||
label = "misc/loadscreen_decor.png"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
{_GUI_PADDING}
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
||||
|
||||
#undef _GUI_PADDING
|
BIN
images/misc/loadscreen_decor.png
Normal file
BIN
images/misc/loadscreen_decor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 662 B |
|
@ -559,6 +559,8 @@
|
|||
<Unit filename="../../src/gui/dialogs/label_settings.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/language_selection.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/language_selection.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/loadscreen.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/loadscreen.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/lobby/data.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/lobby/data.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/lobby/info.cpp" />
|
||||
|
@ -764,8 +766,6 @@
|
|||
<Unit filename="../../src/leader_scroll_dialog.hpp" />
|
||||
<Unit filename="../../src/lexical_cast.hpp" />
|
||||
<Unit filename="../../src/libc_error.hpp" />
|
||||
<Unit filename="../../src/loadscreen.cpp" />
|
||||
<Unit filename="../../src/loadscreen.hpp" />
|
||||
<Unit filename="../../src/lobby_preferences.cpp" />
|
||||
<Unit filename="../../src/lobby_preferences.hpp" />
|
||||
<Unit filename="../../src/log.cpp" />
|
||||
|
|
|
@ -72,7 +72,6 @@
|
|||
<Unit filename="../../src/global.hpp" />
|
||||
<Unit filename="../../src/libc_error.hpp" />
|
||||
<Unit filename="../../src/loadscreen.hpp" />
|
||||
<Unit filename="../../src/loadscreen_empty.cpp" />
|
||||
<Unit filename="../../src/log.cpp" />
|
||||
<Unit filename="../../src/log.hpp" />
|
||||
<Unit filename="../../src/log_windows.cpp" />
|
||||
|
|
|
@ -837,6 +837,7 @@ set(wesnoth-main_SRC
|
|||
gui/dialogs/gamestate_inspector.cpp
|
||||
gui/dialogs/label_settings.cpp
|
||||
gui/dialogs/language_selection.cpp
|
||||
gui/dialogs/loadscreen.cpp.cpp
|
||||
gui/dialogs/lobby/data.cpp
|
||||
gui/dialogs/lobby/info.cpp
|
||||
gui/dialogs/lobby/lobby.cpp
|
||||
|
@ -1026,7 +1027,6 @@ set(libwesnoth-game_STAT_SRC
|
|||
game_end_exceptions.cpp
|
||||
key.cpp
|
||||
language.cpp
|
||||
loadscreen.cpp
|
||||
lobby_preferences.cpp
|
||||
utils/make_enum.cpp
|
||||
map/label.cpp
|
||||
|
@ -1177,7 +1177,6 @@ set(wesnothd_SRC
|
|||
server/forum_user_handler.cpp
|
||||
server/sample_user_handler.cpp
|
||||
${network_implementation_files}
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
add_executable(wesnothd WIN32
|
||||
|
@ -1202,7 +1201,6 @@ set(campaignd_SRC
|
|||
campaign_server/campaign_server.cpp
|
||||
server/input_stream.cpp
|
||||
${network_implementation_files}
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
|
||||
|
@ -1236,7 +1234,6 @@ set(exploder_SRC
|
|||
tools/dummy_video.cpp
|
||||
sdl/utils.cpp
|
||||
tracer.cpp
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
add_executable(exploder ${exploder_SRC})
|
||||
|
@ -1257,7 +1254,6 @@ set(cutter_SRC
|
|||
tools/dummy_video.cpp
|
||||
sdl/utils.cpp
|
||||
tracer.cpp
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
add_executable(cutter ${cutter_SRC})
|
||||
|
@ -1279,7 +1275,6 @@ set(schema_generator_SRC
|
|||
tools/schema/tag.cpp
|
||||
filesystem_boost.cpp
|
||||
filesystem_common.cpp
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
add_executable(schema_generator ${schema_generator_SRC})
|
||||
|
@ -1303,7 +1298,6 @@ set(schema_validator_SRC
|
|||
filesystem_common.cpp
|
||||
config_cache.cpp
|
||||
utils/sha1.cpp
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
add_executable(schema_validator ${schema_validator_SRC})
|
||||
|
@ -1328,7 +1322,6 @@ set(wesmage_SRC
|
|||
tools/exploder_utils.cpp
|
||||
sdl/utils.cpp
|
||||
tracer.cpp
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
add_executable(wesmage ${wesmage_SRC})
|
||||
|
@ -1482,7 +1475,6 @@ if(ENABLE_TESTS)
|
|||
tools/exploder_utils.cpp
|
||||
sdl/utils.cpp
|
||||
tracer.cpp
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
||||
add_executable(create_images ${create_images_SRC})
|
||||
|
|
|
@ -113,7 +113,6 @@ libwesnoth_sources = Split("""
|
|||
generators/lua_map_generator.cpp
|
||||
key.cpp
|
||||
language.cpp
|
||||
loadscreen.cpp
|
||||
utils/make_enum.cpp
|
||||
map/label.cpp
|
||||
marked-up_text.cpp
|
||||
|
@ -154,7 +153,6 @@ libwesnoth_sources = Split("""
|
|||
libwesnoth = client_env.Library("wesnoth", libwesnoth_sources)
|
||||
|
||||
libwesnothd_sources = Split("""
|
||||
loadscreen_empty.cpp
|
||||
tools/dummy_video.cpp
|
||||
""")
|
||||
libwesnothd = env.Library("wesnothd", libwesnothd_sources)
|
||||
|
@ -375,6 +373,7 @@ wesnoth_sources = Split("""
|
|||
gui/dialogs/gamestate_inspector.cpp
|
||||
gui/dialogs/label_settings.cpp
|
||||
gui/dialogs/language_selection.cpp
|
||||
gui/dialogs/loadscreen.cpp.cpp
|
||||
gui/dialogs/lobby/data.cpp
|
||||
gui/dialogs/lobby/info.cpp
|
||||
gui/dialogs/lobby/lobby.cpp
|
||||
|
@ -686,7 +685,6 @@ wesmage_sources = Split("""
|
|||
sdl/alpha.cpp
|
||||
sdl/window.cpp
|
||||
tracer.cpp
|
||||
loadscreen_empty.cpp
|
||||
""")
|
||||
client_env.WesnothProgram("wesmage", wesmage_sources + [libwesnoth_core], have_client_prereqs, OBJPREFIX = "wesmage_", LIBS = ["$LIBS", "png"])
|
||||
|
||||
|
@ -738,7 +736,6 @@ create_images_sources = Split("""
|
|||
sdl/alpha.cpp
|
||||
sdl/window.cpp
|
||||
tracer.cpp
|
||||
loadscreen_empty.cpp
|
||||
""")
|
||||
|
||||
env.WesnothProgram("create_images", create_images_sources + [libwesnoth_core], have_server_prereqs, OBJPREFIX = "create_images_", LIBS = ["$LIBS", "png"])
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "config.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "loadscreen.hpp"
|
||||
#include "log.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
|
@ -178,7 +177,6 @@ static void get_file_tree_checksum_internal(const std::string& path, file_tree_c
|
|||
|
||||
std::vector<std::string> dirs;
|
||||
get_files_in_dir(path,NULL,&dirs, ENTIRE_FILE_PATH, SKIP_MEDIA_DIR, DONT_REORDER, &res);
|
||||
loadscreen::increment_progress();
|
||||
|
||||
for(std::vector<std::string>::const_iterator j = dirs.begin(); j != dirs.end(); ++j) {
|
||||
get_file_tree_checksum_internal(*j,res);
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
#include "game_config.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "game_classification.hpp"
|
||||
#include "gui/dialogs/loadscreen.hpp"
|
||||
#include "gui/dialogs/wml_error.hpp"
|
||||
#include "hotkey/hotkey_item.hpp"
|
||||
#include "hotkey/hotkey_command.hpp"
|
||||
#include "language.hpp"
|
||||
#include "loadscreen.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences.hpp"
|
||||
#include "scripting/game_lua_kernel.hpp"
|
||||
|
@ -138,8 +138,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
}
|
||||
}
|
||||
|
||||
loadscreen::global_loadscreen_manager loadscreen_manager(video_);
|
||||
cursor::setter cur(cursor::WAIT);
|
||||
gui2::tloadscreen::display(video_);
|
||||
|
||||
// The loadscreen will erase the titlescreen.
|
||||
// NOTE: even without loadscreen, needed after MP lobby.
|
||||
|
@ -151,9 +150,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
|
|||
// Load the selected core.
|
||||
// Handle terrains so that they are last loaded from the core.
|
||||
// Load every compatible addon.
|
||||
loadscreen::start_stage("verify cache");
|
||||
filesystem::data_tree_checksum();
|
||||
loadscreen::start_stage("create cache");
|
||||
|
||||
// Start transaction so macros are shared.
|
||||
game_config::config_cache_transaction main_transaction;
|
||||
|
@ -473,7 +470,6 @@ void game_config_manager::set_color_info()
|
|||
void game_config_manager::set_unit_data()
|
||||
{
|
||||
game_config_.merge_children("units");
|
||||
loadscreen::start_stage("load unit types");
|
||||
if(config &units = game_config_.child("units")) {
|
||||
unit_types.set_config(units);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "generators/map_generator.hpp" // for mapgen_exception
|
||||
#include "gettext.hpp" // for _
|
||||
#include "gui/dialogs/language_selection.hpp" // for tlanguage_selection
|
||||
#include "gui/dialogs/loadscreen.hpp"
|
||||
#include "gui/dialogs/message.hpp" //for show error message
|
||||
#include "gui/dialogs/multiplayer/mp_host_game_prompt.hpp" //for host game prompt
|
||||
#include "gui/dialogs/multiplayer/mp_method_selection.hpp"
|
||||
|
@ -39,7 +40,6 @@
|
|||
#include "gui/widgets/window.hpp" // for twindow, etc
|
||||
#include "intro.hpp"
|
||||
#include "language.hpp" // for language_def, etc
|
||||
#include "loadscreen.hpp" // for loadscreen, etc
|
||||
#include "log.hpp" // for LOG_STREAM, logger, general, etc
|
||||
#include "map/exception.hpp"
|
||||
#include "game_initialization/multiplayer.hpp" // for start_client, etc
|
||||
|
@ -1011,8 +1011,8 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
|||
return;
|
||||
}
|
||||
|
||||
loadscreen::global_loadscreen_manager loadscreen_manager(video());
|
||||
loadscreen::start_stage("load data");
|
||||
gui2::tloadscreen::display(video());
|
||||
|
||||
if(reload == RELOAD_DATA) {
|
||||
try {
|
||||
game_config_manager::get()->
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "game_board.hpp"
|
||||
#include "game_data.hpp"
|
||||
#include "game_events/manager.hpp"
|
||||
#include "loadscreen.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "pathfind/pathfind.hpp"
|
||||
|
@ -177,7 +176,6 @@ void game_state::init(const config& level, play_controller & pc)
|
|||
}
|
||||
|
||||
LOG_NG << "initialized teams... " << (SDL_GetTicks() - pc.ticks()) << std::endl;
|
||||
//loadscreen::start_stage("init teams");
|
||||
|
||||
board_.teams_.resize(level.child_count("side"));
|
||||
|
||||
|
|
67
src/gui/dialogs/loadscreen.cpp
Normal file
67
src/gui/dialogs/loadscreen.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
||||
#include "cursor.hpp"
|
||||
#include "gui/dialogs/loadscreen.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "video.hpp"
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(loadscreen)
|
||||
|
||||
void tloadscreen::show(CVideo& video)
|
||||
{
|
||||
if(video.faked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
window_ = build_window(video);
|
||||
|
||||
pre_show(*window_);
|
||||
|
||||
window_->show_non_modal();
|
||||
|
||||
post_show(*window_);
|
||||
}
|
||||
|
||||
void tloadscreen::close()
|
||||
{
|
||||
if(window_) {
|
||||
window_->undraw();
|
||||
delete window_;
|
||||
window_ = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
twindow* tloadscreen::build_window(CVideo& video) const
|
||||
{
|
||||
return build(video, window_id());
|
||||
}
|
||||
|
||||
void tloadscreen::pre_show(twindow& /*window*/)
|
||||
{
|
||||
// FIXME
|
||||
cursor::setter cur(cursor::WAIT);
|
||||
}
|
||||
|
||||
void tloadscreen::post_show(twindow& /*window*/)
|
||||
{
|
||||
cursor::setter cur(cursor::NORMAL);
|
||||
}
|
||||
|
||||
} // namespace gui2
|
66
src/gui/dialogs/loadscreen.hpp
Normal file
66
src/gui/dialogs/loadscreen.hpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
|
||||
class CVideo;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
class twindow;
|
||||
|
||||
class tloadscreen : public tdialog
|
||||
{
|
||||
public:
|
||||
tloadscreen()
|
||||
: window_(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
~tloadscreen()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
static void display(CVideo& video) {
|
||||
tloadscreen().show(video);
|
||||
}
|
||||
|
||||
void show(CVideo& video);
|
||||
|
||||
/**
|
||||
* Hides the window.
|
||||
*
|
||||
* The hiding also destroys the window. It is save to call the function
|
||||
* when the window is not shown.
|
||||
*/
|
||||
void close();
|
||||
|
||||
private:
|
||||
twindow* window_;
|
||||
|
||||
twindow* build_window(CVideo& video) const;
|
||||
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(twindow& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void post_show(twindow& window);
|
||||
};
|
||||
|
||||
} // namespace gui2
|
|
@ -1,420 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2005 - 2016 by Joeri Melis <joeri_melis@hotmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Screen with logo and "Loading ..."-progressbar during program-startup.
|
||||
*/
|
||||
|
||||
#include "loadscreen.hpp"
|
||||
|
||||
#include "log.hpp"
|
||||
#include "font.hpp"
|
||||
#include "marked-up_text.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "sdl/rect.hpp"
|
||||
#include "video.hpp"
|
||||
#include "image.hpp"
|
||||
#include "text.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
||||
#include <SDL_events.h>
|
||||
#include <SDL_image.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
static lg::log_domain log_display("display");
|
||||
static lg::log_domain log_loadscreen("loadscreen");
|
||||
#define LOG_LS LOG_STREAM(info, log_loadscreen)
|
||||
#define ERR_DP LOG_STREAM(err, log_display)
|
||||
|
||||
loadscreen::global_loadscreen_manager* loadscreen::global_loadscreen_manager::manager = NULL;
|
||||
|
||||
loadscreen::global_loadscreen_manager::global_loadscreen_manager(CVideo& screen)
|
||||
: owns(global_loadscreen == NULL)
|
||||
{
|
||||
if(owns) {
|
||||
manager = this;
|
||||
global_loadscreen = new loadscreen(screen);
|
||||
global_loadscreen->clear_screen();
|
||||
}
|
||||
}
|
||||
|
||||
loadscreen::global_loadscreen_manager::~global_loadscreen_manager()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void loadscreen::global_loadscreen_manager::reset()
|
||||
{
|
||||
if(owns) {
|
||||
owns = false;
|
||||
manager = NULL;
|
||||
assert(global_loadscreen);
|
||||
global_loadscreen->clear_screen();
|
||||
delete global_loadscreen;
|
||||
global_loadscreen = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
loadscreen::loadscreen(CVideo &screen, const int percent):
|
||||
screen_(screen),
|
||||
textarea_(),
|
||||
#ifdef SDL_GPU
|
||||
logo_image_(image::get_texture("misc/logo-bg.png~BLIT(misc/logo.png)")),
|
||||
#else
|
||||
logo_surface_(image::get_image("misc/logo-bg.png~BLIT(misc/logo.png)")),
|
||||
#endif
|
||||
logo_drawn_(false),
|
||||
pby_offset_(0),
|
||||
prcnt_(percent)
|
||||
{
|
||||
#ifdef SDL_GPU
|
||||
if (logo_image_.null()) {
|
||||
ERR_DP << "loadscreen: Failed to load the logo" << std::endl;
|
||||
}
|
||||
#else
|
||||
if (logo_surface_.null()) {
|
||||
ERR_DP << "loadscreen: Failed to load the logo" << std::endl;
|
||||
}
|
||||
#endif
|
||||
textarea_.x = textarea_.y = textarea_.w = textarea_.h = 0;
|
||||
}
|
||||
void loadscreen::draw_screen(const std::string &text)
|
||||
{
|
||||
if (screen_.faked()) return; // We seem to encounter segfault in the test executable if this is not done
|
||||
|
||||
// Set progress bar parameters:
|
||||
//
|
||||
// RGB-values for finished piece.
|
||||
int fcr = 21, fcg = 53, fcb = 80;
|
||||
// Groove.
|
||||
int lcr = 21, lcg = 22, lcb = 24;
|
||||
// Border color.
|
||||
int bcr = 188, bcg = 176, bcb = 136;
|
||||
// Border width.
|
||||
int bw = 1;
|
||||
// Border inner spacing width.
|
||||
int bispw = 1;
|
||||
bw = 2*(bw+bispw) > screen_.getx() ? 0: 2*(bw+bispw) > screen_.gety() ? 0: bw;
|
||||
// Available width.
|
||||
int scrx = screen_.getx() - 2*(bw+bispw);
|
||||
// Available height.
|
||||
int scry = screen_.gety() - 2*(bw+bispw);
|
||||
// Used width.
|
||||
int pbw = scrx/2;
|
||||
// Used height.
|
||||
int pbh = scry/16;
|
||||
// Height of the lighting line.
|
||||
int lightning_thickness = 2;
|
||||
|
||||
#ifdef SDL_GPU
|
||||
SDL_Rect area;
|
||||
|
||||
// Pump events and make sure to redraw the logo if there's a chance that it's been obscured
|
||||
SDL_Event ev;
|
||||
while(SDL_PollEvent(&ev)) {
|
||||
if(ev.type == SDL_VIDEORESIZE || ev.type == SDL_VIDEOEXPOSE)
|
||||
{
|
||||
logo_drawn_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw logo if it was successfully loaded.
|
||||
if (!logo_image_.null() && !logo_drawn_) {
|
||||
area.x = (screen_.getx () - logo_image_.width()) / 2;
|
||||
area.y = ((scry - logo_image_.height()) / 2) - pbh;
|
||||
area.w = logo_image_.width();
|
||||
area.h = logo_image_.height();
|
||||
// Check if we have enough pixels to display it.
|
||||
if (area.x > 0 && area.y > 0) {
|
||||
pby_offset_ = (pbh + area.h)/2;
|
||||
screen_.draw_texture(logo_image_, area.x, area.y);
|
||||
} else {
|
||||
if (!screen_.faked()) { // Avoid error if --nogui is used.
|
||||
ERR_DP << "loadscreen: Logo image is too big." << std::endl;
|
||||
}
|
||||
}
|
||||
logo_drawn_ = true;
|
||||
}
|
||||
int pbx = (scrx - pbw)/2; // Horizontal location.
|
||||
int pby = (scry - pbh)/2 + pby_offset_; // Vertical location.
|
||||
|
||||
// Draw top border.
|
||||
area.x = pbx; area.y = pby;
|
||||
area.w = pbw + 2*(bw+bispw); area.h = bw;
|
||||
sdl::fill_rect(screen_, area, bcr, bcg, bcb);
|
||||
// Draw bottom border.
|
||||
area.x = pbx; area.y = pby + pbh + bw + 2*bispw;
|
||||
area.w = pbw + 2*(bw+bispw); area.h = bw;
|
||||
sdl::fill_rect(screen_, area, bcr, bcg, bcb);
|
||||
// Draw left border.
|
||||
area.x = pbx; area.y = pby + bw;
|
||||
area.w = bw; area.h = pbh + 2*bispw;
|
||||
sdl::fill_rect(screen_, area, bcr, bcg, bcb);
|
||||
// Draw right border.
|
||||
area.x = pbx + pbw + bw + 2*bispw; area.y = pby + bw;
|
||||
area.w = bw; area.h = pbh + 2*bispw;
|
||||
sdl::fill_rect(screen_, area, bcr, bcg, bcb);
|
||||
// Draw the finished bar area.
|
||||
area.x = pbx + bw + bispw; area.y = pby + bw + bispw;
|
||||
area.w = (prcnt_ * pbw) / 100; area.h = pbh;
|
||||
sdl::fill_rect(screen_, area, fcr, fcg, fcb);
|
||||
|
||||
SDL_Rect lightning = area;
|
||||
lightning.h = lightning_thickness;
|
||||
//we add 25% of white to the color of the bar to simulate a light effect
|
||||
sdl::fill_rect(screen_, lightning, (fcr*3+255)/4, (fcg*3+255)/4, (fcb*3+255)/4);
|
||||
lightning.y = area.y+area.h-lightning.h;
|
||||
//remove 50% of color to simulate a shadow effect
|
||||
sdl::fill_rect(screen_, lightning, fcr/2, fcg/2, fcb/2);
|
||||
|
||||
// Draw the leftover bar area.
|
||||
area.x = pbx + bw + bispw + (prcnt_ * pbw) / 100; area.y = pby + bw + bispw;
|
||||
area.w = ((100 - prcnt_) * pbw) / 100; area.h = pbh;
|
||||
sdl::fill_rect(screen_, area, lcr, lcg, lcb);
|
||||
|
||||
// Clear the last text and draw new if text is provided.
|
||||
if (!text.empty())
|
||||
{
|
||||
sdl::fill_rect(screen_, textarea_, 0, 0, 0);
|
||||
font::ttext label;
|
||||
label.set_text(text, false);
|
||||
sdl::timage txt = label.render_as_texture();
|
||||
textarea_.w = txt.width();
|
||||
textarea_.h = txt.height();
|
||||
textarea_.x = scrx/2 + bw + bispw - textarea_.w / 2;
|
||||
textarea_.y = pby + pbh + 4*(bw + bispw);
|
||||
screen_.draw_texture(txt, textarea_.x, textarea_.y);
|
||||
}
|
||||
screen_.flip();
|
||||
#else
|
||||
surface& gdis = screen_.getSurface();
|
||||
SDL_Rect area;
|
||||
|
||||
// Pump events and make sure to redraw the logo if there's a chance that it's been obscured
|
||||
SDL_Event ev;
|
||||
while(SDL_PollEvent(&ev)) {
|
||||
if (ev.type == SDL_WINDOWEVENT &&
|
||||
ev.window.event == SDL_WINDOWEVENT_RESIZED) {
|
||||
screen_.update_framebuffer();
|
||||
}
|
||||
if (ev.type == SDL_WINDOWEVENT &&
|
||||
(ev.window.event == SDL_WINDOWEVENT_RESIZED ||
|
||||
ev.window.event == SDL_WINDOWEVENT_EXPOSED))
|
||||
{
|
||||
logo_drawn_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw logo if it was successfully loaded.
|
||||
if (logo_surface_ && !logo_drawn_) {
|
||||
area.x = (screen_.getx () - logo_surface_->w) / 2;
|
||||
area.y = ((scry - logo_surface_->h) / 2) - pbh;
|
||||
area.w = logo_surface_->w;
|
||||
area.h = logo_surface_->h;
|
||||
// Check if we have enough pixels to display it.
|
||||
if (area.x > 0 && area.y > 0) {
|
||||
pby_offset_ = (pbh + area.h)/2;
|
||||
sdl_blit(logo_surface_, 0, gdis, &area);
|
||||
} else {
|
||||
if (!screen_.faked()) { // Avoid error if --nogui is used.
|
||||
ERR_DP << "loadscreen: Logo image is too big." << std::endl;
|
||||
}
|
||||
}
|
||||
logo_drawn_ = true;
|
||||
update_rect(area.x, area.y, area.w, area.h);
|
||||
}
|
||||
int pbx = (scrx - pbw)/2; // Horizontal location.
|
||||
int pby = (scry - pbh)/2 + pby_offset_; // Vertical location.
|
||||
|
||||
// Draw top border.
|
||||
area.x = pbx; area.y = pby;
|
||||
area.w = pbw + 2*(bw+bispw); area.h = bw;
|
||||
sdl::fill_rect(gdis,&area,SDL_MapRGB(gdis->format,bcr,bcg,bcb));
|
||||
// Draw bottom border.
|
||||
area.x = pbx; area.y = pby + pbh + bw + 2*bispw;
|
||||
area.w = pbw + 2*(bw+bispw); area.h = bw;
|
||||
sdl::fill_rect(gdis,&area,SDL_MapRGB(gdis->format,bcr,bcg,bcb));
|
||||
// Draw left border.
|
||||
area.x = pbx; area.y = pby + bw;
|
||||
area.w = bw; area.h = pbh + 2*bispw;
|
||||
sdl::fill_rect(gdis,&area,SDL_MapRGB(gdis->format,bcr,bcg,bcb));
|
||||
// Draw right border.
|
||||
area.x = pbx + pbw + bw + 2*bispw; area.y = pby + bw;
|
||||
area.w = bw; area.h = pbh + 2*bispw;
|
||||
sdl::fill_rect(gdis,&area,SDL_MapRGB(gdis->format,bcr,bcg,bcb));
|
||||
// Draw the finished bar area.
|
||||
area.x = pbx + bw + bispw; area.y = pby + bw + bispw;
|
||||
area.w = (prcnt_ * pbw) / 100; area.h = pbh;
|
||||
sdl::fill_rect(gdis,&area,SDL_MapRGB(gdis->format,fcr,fcg,fcb));
|
||||
|
||||
SDL_Rect lightning = area;
|
||||
lightning.h = lightning_thickness;
|
||||
//we add 25% of white to the color of the bar to simulate a light effect
|
||||
sdl::fill_rect(gdis,&lightning,SDL_MapRGB(gdis->format,(fcr*3+255)/4,(fcg*3+255)/4,(fcb*3+255)/4));
|
||||
lightning.y = area.y+area.h-lightning.h;
|
||||
//remove 50% of color to simulate a shadow effect
|
||||
sdl::fill_rect(gdis,&lightning,SDL_MapRGB(gdis->format,fcr/2,fcg/2,fcb/2));
|
||||
|
||||
// Draw the leftover bar area.
|
||||
area.x = pbx + bw + bispw + (prcnt_ * pbw) / 100; area.y = pby + bw + bispw;
|
||||
area.w = ((100 - prcnt_) * pbw) / 100; area.h = pbh;
|
||||
sdl::fill_rect(gdis,&area,SDL_MapRGB(gdis->format,lcr,lcg,lcb));
|
||||
|
||||
// Clear the last text and draw new if text is provided.
|
||||
if (!text.empty())
|
||||
{
|
||||
SDL_Rect oldarea = textarea_;
|
||||
sdl::fill_rect(gdis,&textarea_,SDL_MapRGB(gdis->format,0,0,0));
|
||||
textarea_ = font::line_size(text, preferences::font_scaled(font::SIZE_NORMAL));
|
||||
textarea_.x = scrx/2 + bw + bispw - textarea_.w / 2;
|
||||
textarea_.y = pby + pbh + 4*(bw + bispw);
|
||||
textarea_ = font::draw_text(&screen_,textarea_,font::SIZE_NORMAL,font::NORMAL_COLOR,text,textarea_.x,textarea_.y);
|
||||
SDL_Rect refresh = sdl::union_rects(oldarea, textarea_);
|
||||
update_rect(refresh.x, refresh.y, refresh.w, refresh.h);
|
||||
}
|
||||
// Update the rectangle.
|
||||
update_rect(pbx, pby, pbw + 2*(bw + bispw), pbh + 2*(bw + bispw));
|
||||
screen_.flip();
|
||||
#endif
|
||||
}
|
||||
|
||||
void loadscreen::clear_screen()
|
||||
{
|
||||
#ifdef SDL_GPU
|
||||
GPU_Clear(get_render_target());
|
||||
#else
|
||||
int scrx = screen_.getx(); // Screen width.
|
||||
int scry = screen_.gety(); // Screen height.
|
||||
SDL_Rect area = sdl::create_rect(0, 0, scrx, scry); // Screen area.
|
||||
surface& disp(screen_.getSurface()); // Screen surface.
|
||||
// Make everything black.
|
||||
sdl::fill_rect(disp,&area,SDL_MapRGB(disp->format,0,0,0));
|
||||
screen_.flip();
|
||||
#endif
|
||||
}
|
||||
|
||||
loadscreen *loadscreen::global_loadscreen = 0;
|
||||
|
||||
struct load_stage
|
||||
{
|
||||
char const *id;
|
||||
char const *name;
|
||||
int start_pos, max_count;
|
||||
};
|
||||
|
||||
static int const nb_stages = 19;
|
||||
|
||||
/**
|
||||
* Description of all the stages.
|
||||
* @note Some of the stages appear twice; this is not a mistake. It
|
||||
* accounts for their cost at title time and at game time.
|
||||
* @note The values have been automatically generated by running a cache-hot
|
||||
* Wesnoth on HttH with the --log-info=loadscreen option.
|
||||
*/
|
||||
static load_stage const stages[nb_stages] =
|
||||
{
|
||||
{ "init gui", N_("Initializing user interface"), 0, 27089 },
|
||||
{ "load config", N_("Loading game configuration"), 46, 0 },
|
||||
{ "verify cache", N_("Verifying cache"), 46, 179 },
|
||||
{ "create cache", N_("Reading files and creating cache"), 47, 60317 },
|
||||
{ "load unit types", N_("Reading unit files"), 85, 531 },
|
||||
{ "init fonts", N_("Reinitialize fonts for the current language"), 96, 21 },
|
||||
{ "refresh addons", N_("Searching for installed add-ons"), 99, 0 },
|
||||
{ "titlescreen", N_("Loading title screen"), 100, 0 },
|
||||
{ "load data", N_("Loading data files"), 0, 0 },
|
||||
{ "verify cache", N_("Verifying cache"), 0, 0 },
|
||||
{ "create cache", N_("Reading files and creating cache"), 0, 152852 },
|
||||
{ "load unit types", N_("Reading unit files"), 38, 553 },
|
||||
{ "load level", N_("Loading level"), 41, 0 },
|
||||
{ "init teams", N_("Initializing teams"), 41, 0 },
|
||||
{ "load units", N_("Loading units"), 43, 0 },
|
||||
{ "init theme", N_("Initializing display"), 43, 0 },
|
||||
{ "build terrain", N_("Building terrain rules"), 43, 1545 },
|
||||
{ "init display", N_("Initializing display"), 99, 0 },
|
||||
{ "start game", N_("Starting game"), 100, 0 },
|
||||
};
|
||||
|
||||
static int current_stage;
|
||||
static int stage_counter[nb_stages];
|
||||
static unsigned stage_time[nb_stages];
|
||||
|
||||
void loadscreen::start_stage(char const *id)
|
||||
{
|
||||
assert(global_loadscreen);
|
||||
|
||||
int s = -1;
|
||||
for (int i = 0; i < nb_stages; ++i) {
|
||||
int j = (i + current_stage) % nb_stages;
|
||||
if (strcmp(id, stages[j].id) == 0) {
|
||||
s = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(s >= 0);
|
||||
|
||||
const load_stage &cs = stages[s];
|
||||
global_loadscreen->prcnt_ = cs.start_pos;
|
||||
global_loadscreen->draw_screen(translation::gettext(cs.name));
|
||||
stage_counter[s] = 0;
|
||||
stage_time[s] = SDL_GetTicks();
|
||||
current_stage = s;
|
||||
}
|
||||
|
||||
void loadscreen::increment_progress()
|
||||
{
|
||||
if (!global_loadscreen) return;
|
||||
|
||||
int v = ++stage_counter[current_stage];
|
||||
int m = stages[current_stage].max_count;
|
||||
if (v > m) return;
|
||||
|
||||
int s = stages[current_stage].start_pos;
|
||||
int percentage = s + v * (stages[current_stage + 1].start_pos - s) / m;
|
||||
if (percentage == global_loadscreen->prcnt_) return;
|
||||
|
||||
global_loadscreen->prcnt_ = percentage;
|
||||
global_loadscreen->draw_screen(std::string());
|
||||
}
|
||||
|
||||
void loadscreen::dump_counters() const
|
||||
{
|
||||
if (lg::info().dont_log(log_loadscreen)) return;
|
||||
|
||||
std::ostringstream s;
|
||||
|
||||
int i = 0;
|
||||
while (i < nb_stages)
|
||||
{
|
||||
int j;
|
||||
for (j = i; stages[j].start_pos < 100; ++j) {}
|
||||
if (stage_time[i] == stage_time[j]) break;
|
||||
for (int k = i; k <= j; ++k)
|
||||
{
|
||||
int v = stages[k].start_pos;
|
||||
if (i < k && k < j) {
|
||||
v = stages[i].start_pos +
|
||||
(100 - stages[i].start_pos) *
|
||||
(stage_time[k] - stage_time[i]) /
|
||||
(stage_time[j] - stage_time[i]);
|
||||
}
|
||||
s << "\t{ \"" << stages[k].id << "\", N_(\""
|
||||
<< stages[k].name << "\"), " << v << ", "
|
||||
<< stage_counter[k] << " },\n";
|
||||
}
|
||||
i = j + 1;
|
||||
}
|
||||
LOG_LS << "Suggested loadscreen values:\n---\n" << s.str() << "---\n";
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2005 - 2016 by Joeri Melis <joeri_melis@hotmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
/** @file */
|
||||
|
||||
#ifndef JM_LOADSCREEN_HPP
|
||||
#define JM_LOADSCREEN_HPP
|
||||
|
||||
class CVideo;
|
||||
|
||||
#include "sdl/utils.hpp"
|
||||
#include "sdl/gpu.hpp"
|
||||
#include "sdl/image.hpp"
|
||||
|
||||
class loadscreen {
|
||||
public:
|
||||
// Preferred constructor
|
||||
explicit loadscreen(CVideo &screen, const int percent = 0);
|
||||
// Keep default copy constructor
|
||||
// Keep default copy assignment
|
||||
// Destructor, dumps the counter values to stderr
|
||||
~loadscreen()
|
||||
{
|
||||
dump_counters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the stage with identifier @a id.
|
||||
*/
|
||||
static void start_stage(char const *id);
|
||||
|
||||
/**
|
||||
* Increments the current stage for the progress bar.
|
||||
*/
|
||||
static void increment_progress();
|
||||
|
||||
/** Function to draw a blank screen. */
|
||||
void clear_screen();
|
||||
|
||||
/**
|
||||
* A global loadscreen instance that can be used to avoid
|
||||
* passing it on to functions that are many levels deep.
|
||||
*/
|
||||
static loadscreen *global_loadscreen;
|
||||
|
||||
struct global_loadscreen_manager {
|
||||
explicit global_loadscreen_manager(CVideo& screen);
|
||||
~global_loadscreen_manager();
|
||||
static global_loadscreen_manager* get()
|
||||
{ return manager; }
|
||||
void reset();
|
||||
private:
|
||||
static global_loadscreen_manager* manager;
|
||||
bool owns;
|
||||
};
|
||||
private:
|
||||
/**
|
||||
* Displays a load progress bar.
|
||||
*/
|
||||
void draw_screen(const std::string &text);
|
||||
|
||||
// Prohibit default constructor
|
||||
loadscreen();
|
||||
|
||||
// Data members
|
||||
CVideo &screen_;
|
||||
SDL_Rect textarea_;
|
||||
#ifdef SDL_GPU
|
||||
sdl::timage logo_image_;
|
||||
#else
|
||||
surface logo_surface_;
|
||||
#endif
|
||||
bool logo_drawn_;
|
||||
int pby_offset_;
|
||||
int prcnt_;
|
||||
|
||||
void dump_counters() const;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2005 - 2016 by Joeri Melis <joeri_melis@hotmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
/** @file */
|
||||
|
||||
#include "loadscreen.hpp"
|
||||
|
||||
void loadscreen::start_stage(char const *) {}
|
||||
void loadscreen::increment_progress() {}
|
||||
void loadscreen::clear_screen() {}
|
||||
|
||||
loadscreen *loadscreen::global_loadscreen = 0;
|
|
@ -38,10 +38,10 @@
|
|||
#include "hotkey/hotkey_handler.hpp"
|
||||
#include "map/label.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "gui/dialogs/loadscreen.hpp"
|
||||
#include "gui/dialogs/transient_message.hpp"
|
||||
#include "halo.hpp"
|
||||
#include "hotkey/command_executor.hpp"
|
||||
#include "loadscreen.hpp"
|
||||
#include "log.hpp"
|
||||
#include "pathfind/teleport.hpp"
|
||||
#include "preferences_display.hpp"
|
||||
|
@ -224,15 +224,7 @@ struct throw_end_level
|
|||
|
||||
void play_controller::init(CVideo& video, const config& level)
|
||||
{
|
||||
util::scoped_resource<loadscreen::global_loadscreen_manager*, util::delete_item> scoped_loadscreen_manager;
|
||||
loadscreen::global_loadscreen_manager* loadscreen_manager = loadscreen::global_loadscreen_manager::get();
|
||||
if (!loadscreen_manager)
|
||||
{
|
||||
scoped_loadscreen_manager.assign(new loadscreen::global_loadscreen_manager(video));
|
||||
loadscreen_manager = scoped_loadscreen_manager.get();
|
||||
}
|
||||
|
||||
loadscreen::start_stage("load level");
|
||||
gui2::tloadscreen::display(video);
|
||||
|
||||
LOG_NG << "initializing game_state..." << (SDL_GetTicks() - ticks()) << std::endl;
|
||||
gamestate_.reset(new game_state(level, *this, tdata_));
|
||||
|
@ -254,15 +246,12 @@ void play_controller::init(CVideo& video, const config& level)
|
|||
resources::whiteboard = whiteboard_manager_;
|
||||
|
||||
LOG_NG << "loading units..." << (SDL_GetTicks() - ticks()) << std::endl;
|
||||
loadscreen::start_stage("load units");
|
||||
preferences::encounter_all_content(gamestate().board_);
|
||||
|
||||
LOG_NG << "initializing theme... " << (SDL_GetTicks() - ticks()) << std::endl;
|
||||
loadscreen::start_stage("init theme");
|
||||
const config& theme_cfg = controller_base::get_theme(game_config_, level["theme"]);
|
||||
|
||||
LOG_NG << "building terrain rules... " << (SDL_GetTicks() - ticks()) << std::endl;
|
||||
loadscreen::start_stage("build terrain");
|
||||
gui_.reset(new game_display(gamestate().board_, video, whiteboard_manager_, *gamestate().reports_, gamestate().tod_manager_, theme_cfg, level));
|
||||
if (!gui_->video().faked()) {
|
||||
if (saved_game_.mp_settings().mp_countdown)
|
||||
|
@ -271,7 +260,6 @@ void play_controller::init(CVideo& video, const config& level)
|
|||
gui_->get_theme().modify_label("time-icon", _ ("current local time"));
|
||||
}
|
||||
|
||||
loadscreen::start_stage("init display");
|
||||
mouse_handler_.set_gui(gui_.get());
|
||||
menu_handler_.set_gui(gui_.get());
|
||||
resources::screen = gui_.get();
|
||||
|
@ -279,7 +267,6 @@ void play_controller::init(CVideo& video, const config& level)
|
|||
LOG_NG << "done initializing display... " << (SDL_GetTicks() - ticks()) << std::endl;
|
||||
|
||||
LOG_NG << "building gamestate to gui and whiteboard... " << (SDL_GetTicks() - ticks()) << std::endl;
|
||||
//loadscreen::start_stage("build events manager & lua");
|
||||
// This *needs* to be created before the show_intro and show_map_scene
|
||||
// as that functions use the manager state_of_game
|
||||
// Has to be done before registering any events!
|
||||
|
@ -304,8 +291,7 @@ void play_controller::init(CVideo& video, const config& level)
|
|||
}
|
||||
|
||||
init_managers();
|
||||
loadscreen::global_loadscreen->start_stage("start game");
|
||||
loadscreen_manager->reset();
|
||||
//loadscreen_manager->reset();
|
||||
gamestate().gamedata_.set_phase(game_data::PRELOAD);
|
||||
gamestate().lua_kernel_->initialize(level);
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "config.hpp"
|
||||
#include "log.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "loadscreen.hpp"
|
||||
#include "wesconfig.h"
|
||||
#include "serialization/preprocessor.hpp"
|
||||
#include "serialization/tokenizer.hpp"
|
||||
|
@ -136,7 +135,6 @@ void parser::operator()()
|
|||
case token::END:
|
||||
break;
|
||||
}
|
||||
loadscreen::increment_progress();
|
||||
} while (tok_.current_token().type != token::END);
|
||||
|
||||
// The main element should be there. If it is not, this is a parser error.
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "game_preferences.hpp"
|
||||
#include "image.hpp"
|
||||
#include "loadscreen.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
@ -947,8 +946,6 @@ void terrain_builder::parse_config(const config &cfg, bool local)
|
|||
pbr.precedence = br["precedence"];
|
||||
|
||||
add_rotated_rules(building_rules_, pbr, rotations);
|
||||
|
||||
loadscreen::increment_progress();
|
||||
}
|
||||
|
||||
// Debug output for the terrain rules
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "game_config.hpp"
|
||||
#include "game_errors.hpp" //thrown sometimes
|
||||
//#include "gettext.hpp"
|
||||
#include "loadscreen.hpp"
|
||||
#include "log.hpp"
|
||||
#include "utils/make_enum.hpp"
|
||||
#include "units/unit.hpp"
|
||||
|
@ -1012,14 +1011,12 @@ void unit_type_data::set_config(config &cfg)
|
|||
BOOST_FOREACH(const config &mt, cfg.child_range("movetype"))
|
||||
{
|
||||
movement_types_.insert(std::make_pair(mt["name"].str(), movetype(mt)));
|
||||
loadscreen::increment_progress();
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const config &r, cfg.child_range("race"))
|
||||
{
|
||||
const unit_race race(r);
|
||||
races_.insert(std::pair<std::string,unit_race>(race.id(),race));
|
||||
loadscreen::increment_progress();
|
||||
}
|
||||
|
||||
// Movetype resistance patching
|
||||
|
@ -1101,7 +1098,6 @@ void unit_type_data::set_config(config &cfg)
|
|||
if ( !id.empty() ) {
|
||||
std::vector<std::string> base_tree(1, id);
|
||||
apply_base_unit(ut, cfg, base_tree);
|
||||
loadscreen::increment_progress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1135,8 +1131,6 @@ void unit_type_data::set_config(config &cfg)
|
|||
} else {
|
||||
ERR_CF << "Multiple [unit_type]s with id=" << id << " encountered." << std::endl;
|
||||
}
|
||||
|
||||
loadscreen::increment_progress();
|
||||
}
|
||||
|
||||
// Build all unit types. (This was not done within the loop for performance.)
|
||||
|
@ -1202,7 +1196,6 @@ void unit_type_data::build_all(unit_type::BUILD_STATUS status)
|
|||
|
||||
for (unit_type_map::iterator u = types_.begin(), u_end = types_.end(); u != u_end; ++u) {
|
||||
build_unit_type(u->second, status);
|
||||
loadscreen::increment_progress();
|
||||
}
|
||||
// Handle [advancefrom] (once) after building to (at least) the CREATED level.
|
||||
// (Currently, this could be simply a test for build_status_ == NOT_BUILT,
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
#include "gettext.hpp"
|
||||
#include "gui/core/event/handler.hpp" // for tmanager
|
||||
#include "gui/dialogs/core_selection.hpp" // for tcore_selection
|
||||
#include "gui/dialogs/loadscreen.hpp"
|
||||
#include "gui/dialogs/title_screen.hpp" // for ttitle_screen, etc
|
||||
#include "gui/dialogs/message.hpp" // for show_error_message
|
||||
#include "gui/widgets/helper.hpp" // for init
|
||||
#include "help/help.hpp" // for help_manager
|
||||
#include "image.hpp" // for flush_cache, etc
|
||||
#include "loadscreen.hpp" // for loadscreen, etc
|
||||
#include "log.hpp" // for LOG_STREAM, general, logger, etc
|
||||
#include "network.hpp" // for describe_versions
|
||||
#include "preferences.hpp" // for core_id, etc
|
||||
|
@ -46,6 +46,7 @@
|
|||
#include "scripting/plugins/context.hpp"
|
||||
#include "scripting/plugins/manager.hpp"
|
||||
#include "sdl/exception.hpp" // for texception
|
||||
#include "sdl/rect.hpp"
|
||||
#include "serialization/binary_or_text.hpp" // for config_writer
|
||||
#include "serialization/parser.hpp" // for read
|
||||
#include "serialization/preprocessor.hpp" // for preproc_define, etc
|
||||
|
@ -629,28 +630,25 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
|
||||
check_fpu();
|
||||
const cursor::manager cursor_manager;
|
||||
cursor::set(cursor::WAIT);
|
||||
//cursor::set(cursor::WAIT);
|
||||
|
||||
#if (defined(_X11) && !defined(__APPLE__)) || defined(_WIN32)
|
||||
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
|
||||
#endif
|
||||
|
||||
loadscreen::global_loadscreen_manager loadscreen_manager(game->video());
|
||||
|
||||
loadscreen::start_stage("init gui");
|
||||
gui2::init();
|
||||
const gui2::event::tmanager gui_event_manager;
|
||||
|
||||
gui2::tloadscreen::display(game->video());
|
||||
|
||||
game_config_manager config_manager(cmdline_opts, game->video(),
|
||||
game->jump_to_editor());
|
||||
|
||||
loadscreen::start_stage("load config");
|
||||
res = config_manager.init_game_config(game_config_manager::NO_FORCE_RELOAD);
|
||||
if(res == false) {
|
||||
std::cerr << "could not initialize game config\n";
|
||||
return 1;
|
||||
}
|
||||
loadscreen::start_stage("init fonts");
|
||||
|
||||
res = font::load_font_config();
|
||||
if(res == false) {
|
||||
|
@ -658,13 +656,10 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
return 1;
|
||||
}
|
||||
|
||||
loadscreen::start_stage("refresh addons");
|
||||
refresh_addon_version_info_cache();
|
||||
|
||||
config tips_of_day;
|
||||
|
||||
loadscreen::start_stage("titlescreen");
|
||||
|
||||
LOG_CONFIG << "time elapsed: "<< (SDL_GetTicks() - start_ticks) << " ms\n";
|
||||
|
||||
plugins_manager plugins_man(new application_lua_kernel(&game->video()));
|
||||
|
@ -705,8 +700,6 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
}
|
||||
}
|
||||
|
||||
loadscreen_manager.reset();
|
||||
|
||||
handle_lua_script_args(&*game,cmdline_opts);
|
||||
|
||||
plugins.play_slice();
|
||||
|
@ -852,7 +845,7 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
}
|
||||
continue;
|
||||
} else if(res == gui2::ttitle_screen::RELOAD_GAME_DATA) {
|
||||
loadscreen::global_loadscreen_manager loadscreen(game->video());
|
||||
gui2::tloadscreen::display(game->video());
|
||||
config_manager.reload_changed_game_config();
|
||||
image::flush_cache();
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue