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 |
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 |
Inherited from modal_dialog, implemented by REGISTER_DIALOG. More... | |
virtual void | pre_show (window &window) override |
Inherited from modal_dialog. More... | |
void | on_resize (window &window) |
void | update_tip (window &window, 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 (window &window) |
void | button_callback_multiplayer (window &window) |
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.
Definition at line 37 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 48 of file title_screen.hpp.
gui2::dialogs::title_screen::title_screen | ( | game_launcher & | game | ) |
Definition at line 137 of file title_screen.cpp.
gui2::dialogs::title_screen::~title_screen | ( | ) |
Definition at line 147 of file title_screen.cpp.
|
private |
Definition at line 539 of file title_screen.cpp.
References preferences::core_id(), game_config_manager::get(), gui2::dialogs::core_selection::get_choice(), game_config_manager::reload_changed_game_config(), preferences::set_core_id(), and gui2::dialogs::modal_dialog::show().
Referenced by pre_show().
|
private |
Definition at line 499 of file title_screen.cpp.
References preferences::builtin_servers_list(), game_, gui2::dialogs::mp_method_selection::get_choice(), gui2::dialogs::modal_dialog::get_retval(), 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 476 of file title_screen.cpp.
References _(), game_, game_config_manager::get(), LAUNCH_GAME, game_config_manager::load_game_config_for_create(), preferences::options(), gui2::window::set_retval(), game_launcher::set_test(), and sort().
Referenced by pre_show().
|
private |
Definition at line 424 of file title_screen.cpp.
References REDRAW_BACKGROUND, and gui2::window::set_retval().
Referenced by pre_show().
|
overrideprivatevirtual |
Inherited from modal_dialog.
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 209 of file title_screen.cpp.
References gui2::multi_page::add_page(), button_callback_cores(), button_callback_multiplayer(), game_launcher::change_language(), game_launcher::clear_loaded_game(), gui2::event::dispatcher::connect_signal(), e, ERR_CF, sound::flush_cache(), image::flush_cache(), 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(), game_config_manager::reload_changed_game_config(), RELOAD_GAME_DATA, t_string::reset_translations(), 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(), game_launcher::set_tutorial(), gui2::canvas::set_variable(), SHOW_ABOUT, gui2::dialogs::show_debug_clock_button, show_debug_clock_window(), gui2::show_error_message(), help::show_help(), game_launcher::show_preferences(), 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, hotkey::TITLE_SCREEN__TUTORIAL, update_tip(), VGETTEXT, gui2::widget::visible, game::error::what(), and WRN_CF.
|
private |
Shows the debug clock.
Definition at line 464 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.
window | The window being shown. |
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 429 of file title_screen.cpp.
References gui2::multi_page::get_page_count(), gui2::multi_page::get_selected_page(), and gui2::multi_page::select_page().
Referenced by pre_show().
|
overrideprivatevirtual |
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
Implements gui2::dialogs::modal_dialog.
|
private |
Holds the debug clock dialog.
Definition at line 98 of file title_screen.hpp.
Referenced by show_debug_clock_window().
|
private |
Definition at line 100 of file title_screen.hpp.
Referenced by button_callback_multiplayer(), hotkey_callback_select_tests(), and pre_show().