This class implements the title screen. More...
#include <title_screen.hpp>
Public Types | |
enum | result { REDRAW_BACKGROUND = 0, LAUNCH_GAME, MP_CONNECT, MP_HOST, MP_LOCAL, MAP_EDITOR, SHOW_ABOUT, QUIT_GAME, RELOAD_GAME_DATA } |
Values for actions which leave the title screen. More... | |
Public Member Functions | |
title_screen (game_launcher &game) | |
~title_screen () | |
![]() | |
modal_dialog () | |
virtual | ~modal_dialog () |
bool | show (const unsigned auto_close_time=0) |
Shows the window. More... | |
window * | get_window () const |
Returns a pointer to the dialog's window. More... | |
int | get_retval () const |
Returns the cached window exit code. More... | |
void | set_retval (int retval) |
Convenience wrapper to set the window's exit code. More... | |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
void | set_allow_plugin_skip (const bool allow_plugin_skip) |
void | set_show_even_without_video (const bool show_even_without_video) |
Private Member Functions | |
virtual const std::string & | window_id () const override |
The id of the window to build. More... | |
virtual void | pre_show (window &window) override |
Actions to be taken before showing the window. More... | |
void | on_resize () |
void | update_tip (const bool previous) |
Updates the tip of day widget. More... | |
void | show_debug_clock_window () |
Shows the debug clock. More... | |
void | hotkey_callback_select_tests () |
void | button_callback_multiplayer () |
void | button_callback_cores () |
Private Attributes | |
std::unique_ptr< modeless_dialog > | debug_clock_ |
Holds the debug clock dialog. More... | |
game_launcher & | game_ |
Additional Inherited Members | |
![]() | |
field_bool * | register_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_bool * | register_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr) |
Creates a new integer field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false) |
Creates a new text field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
field_label * | register_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false) |
Registers a new styled_widget as a label. More... | |
field_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new styled_widget as image. More... | |
![]() | |
std::unique_ptr< window > | window_ |
The window object build for this dialog. More... | |
This class implements the title screen.
The menu buttons return a result back to the caller with the button pressed. So at the moment it only handles the tips itself.
Key | Type | Mandatory | Description |
---|---|---|---|
tutorial | button | yes | The button to start the tutorial. |
campaign | button | yes | The button to start a campaign. |
multiplayer | button | yes | The button to start multiplayer mode. |
load | button | yes | The button to load a saved game. |
editor | button | yes | The button to start the editor. |
addons | button | yes | The button to start managing the addons. |
cores | button | yes | The button to start managing the cores. |
language | button | yes | The button to select the game language. |
credits | button | yes | The button to show Wesnoth's contributors. |
quit | button | yes | The button to quit Wesnoth. |
tips | multi_page | yes | A multi_page to hold all tips, when this widget is used the area of the tips doesn't need to be resized when the next or previous button is pressed. |
tip | label | no | Shows the text of the current tip. |
source | label | no | The source (the one who's quoted or the book referenced) of the current tip. |
next_tip | button | yes | The button show the next tip of the day. |
previous_tip | button | yes | The button show the previous tip of the day. |
logo | progress_bar | no | A progress bar to "animate" the Wesnoth logo. |
revision_number | control | no | A widget to show the version number when the version number is known. |
Definition at line 57 of file title_screen.hpp.
Values for actions which leave the title screen.
Actions that merely show a dialog are not included here.
Enumerator | |
---|---|
REDRAW_BACKGROUND | |
LAUNCH_GAME | |
MP_CONNECT | |
MP_HOST | |
MP_LOCAL | |
MAP_EDITOR | |
SHOW_ABOUT | |
QUIT_GAME | |
RELOAD_GAME_DATA |
Definition at line 68 of file title_screen.hpp.
gui2::dialogs::title_screen::title_screen | ( | game_launcher & | game | ) |
Definition at line 72 of file title_screen.cpp.
gui2::dialogs::title_screen::~title_screen | ( | ) |
Definition at line 82 of file title_screen.cpp.
|
private |
Definition at line 463 of file title_screen.cpp.
References preferences::core_id(), game_config_manager::get(), gui2::dialogs::core_selection::get_choice(), gui2::dialogs::modal_dialog::get_window(), RELOAD_GAME_DATA, preferences::set_core_id(), gui2::window::set_retval(), and gui2::dialogs::modal_dialog::show().
Referenced by pre_show().
|
private |
Definition at line 423 of file title_screen.cpp.
References preferences::builtin_servers_list(), game_, gui2::dialogs::mp_method_selection::get_choice(), gui2::dialogs::modal_dialog::get_retval(), gui2::dialogs::modal_dialog::get_window(), MP_CONNECT, MP_HOST, MP_LOCAL, preferences::mp_server_warning_disabled(), gui2::OK, game_launcher::select_mp_server(), gui2::window::set_retval(), and gui2::dialogs::modal_dialog::show().
Referenced by pre_show().
|
private |
Definition at line 400 of file title_screen.cpp.
References _(), game_, game_config_manager::get(), LAUNCH_GAME, game_config_manager::load_game_config_for_create(), preferences::options(), gui2::dialogs::modal_dialog::set_retval(), game_launcher::set_test(), and sort().
Referenced by pre_show().
|
private |
Definition at line 348 of file title_screen.cpp.
References REDRAW_BACKGROUND, and gui2::dialogs::modal_dialog::set_retval().
Referenced by pre_show().
|
overrideprivatevirtual |
Actions to be taken before showing the window.
At this point the registered fields are registered and initialized with their initial values.
window | The window to be shown. |
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 144 of file title_screen.cpp.
References gui2::multi_page::add_page(), button_callback_cores(), button_callback_multiplayer(), game_launcher::change_language(), gui2::event::dispatcher::connect_signal(), e, ERR_CF, gui2::event::dispatcher::front_child, game_, game_config::images::game_logo, game_config::images::game_logo_background, game_config::images::game_title, game_config::images::game_title_background, game_config_manager::get(), gui2::styled_widget::get_canvas(), hotkey_callback_select_tests(), hotkey::HOTKEY_HELP, hotkey::HOTKEY_LANGUAGE, hotkey::HOTKEY_LOAD_GAME, hotkey::HOTKEY_NULL, hotkey::HOTKEY_PREFERENCES, hotkey::HOTKEY_QUIT_TO_DESKTOP, hotkey::HOTKEY_SCREENSHOT, gui2::widget::invisible, LAUNCH_GAME, gui2::dialogs::launch_lua_console(), game_launcher::load_game(), hotkey::LUA_CONSOLE, gui2::dialogs::make_screenshot(), manage_addons(), MAP_EDITOR, game_launcher::new_campaign(), gui2::new_widgets, on_resize(), QUIT_GAME, gui2::dialogs::register_button(), gui2::event::dispatcher::register_hotkey(), RELOAD_GAME_DATA, game_config::revision, gui2::event::SDL_MOUSE_MOTION, gui2::event::SDL_VIDEO_RESIZE, gui2::window::set_click_dismiss(), gui2::window::set_enter_disabled(), gui2::window::set_escape_disabled(), gui2::window::set_retval(), gui2::canvas::set_variable(), SHOW_ABOUT, gui2::dialogs::show_debug_clock_button, show_debug_clock_window(), gui2::show_error_message(), help::show_help(), gui2::tip_of_the_day::shuffle(), gui2::dialogs::tip::tip(), gui2::settings::tips, hotkey::TITLE_SCREEN__ADDONS, hotkey::TITLE_SCREEN__CAMPAIGN, hotkey::TITLE_SCREEN__CORES, hotkey::TITLE_SCREEN__CREDITS, hotkey::TITLE_SCREEN__EDITOR, hotkey::TITLE_SCREEN__MULTIPLAYER, hotkey::TITLE_SCREEN__NEXT_TIP, hotkey::TITLE_SCREEN__PREVIOUS_TIP, hotkey::TITLE_SCREEN__RELOAD_WML, hotkey::TITLE_SCREEN__TEST, update_tip(), VGETTEXT, gui2::widget::visible, game::error::what(), and WRN_CF.
|
private |
Shows the debug clock.
Definition at line 388 of file title_screen.cpp.
References debug_clock_, and gui2::dialogs::show_debug_clock_button.
Referenced by pre_show().
|
private |
Updates the tip of day widget.
previous | Show the previous tip, else shows the next one. |
This dirtying is required to avoid the blurring to be rendered wrong. Not entirely sure why, but since we plan to move to SDL2 that change will probably fix this issue automatically.
Definition at line 353 of file title_screen.cpp.
References gui2::multi_page::get_page_count(), gui2::multi_page::get_selected_page(), gui2::dialogs::modal_dialog::get_window(), gui2::multi_page::select_page(), and gui2::widget::set_is_dirty().
Referenced by pre_show().
|
overrideprivatevirtual |
The id of the window to build.
Implements gui2::dialogs::modal_dialog.
|
private |
Holds the debug clock dialog.
Definition at line 115 of file title_screen.hpp.
Referenced by show_debug_clock_window().
|
private |
Definition at line 117 of file title_screen.hpp.
Referenced by button_callback_multiplayer(), hotkey_callback_select_tests(), and pre_show().