#include <multiplayer_ui.hpp>
Public Types | |
enum | result { CONTINUE, JOIN, OBSERVE, CREATE, PREFERENCES, PLAY, QUIT } |
enum | user_relation { ME, FRIEND, NEUTRAL, IGNORED } |
enum | user_state { LOBBY, GAME, SEL_GAME } |
Public Member Functions | |
ui (game_display &d, const std::string &title, const config &cfg, chat &c, config &gamelist) | |
void | process_network () |
result | get_result () |
void | set_location (const SDL_Rect &rect) |
Protected Member Functions | |
int | xscale (int x) const |
int | yscale (int y) const |
SDL_Rect | client_area () const |
game_display & | disp () |
const config & | game_config () const |
virtual void | draw_contents () |
virtual void | process_event () |
virtual void | handle_event (const SDL_Event &event) |
virtual void | handle_key_event (const SDL_KeyboardEvent &event) |
void | add_chat_message (const time_t &time, const std::string &speaker, int side, const std::string &message, game_display::MESSAGE_TYPE type=game_display::MESSAGE_PRIVATE) |
void | send_chat_message (const std::string &message, bool allies_only=false) |
void | process_message (const config &msg, const bool whisper=false) |
Process chat messages. | |
virtual void | process_network_data (const config &data, const network::connection sock) |
virtual void | process_network_error (network::error &error) |
virtual bool | accept_connections () |
virtual void | process_network_connection (const network::connection sock) |
virtual void | hide_children (bool hide=true) |
virtual void | layout_children (const SDL_Rect &rect) |
result | set_result (result res) |
void | set_selected_game (const std::string game_name) |
virtual void | gamelist_updated (bool silent=true) |
void | set_user_list (const std::vector< std::string > &, bool silent) |
void | set_user_menu_items (const std::vector< std::string > &list) |
config & | gamelist () |
void | append_to_title (const std::string &name) |
const gui::label & | title () const |
Protected Attributes | |
game_display & | disp_ |
Static Protected Attributes | |
static const int | xscale_base = 1024 |
static const int | yscale_base = 768 |
Private Attributes | |
bool | initialized_ |
Set to true when the widgets are intialized. | |
bool | gamelist_initialized_ |
const hotkey::basic_handler | hotkey_handler_ |
const preferences::display_manager | disp_manager_ |
const config & | game_config_ |
chat & | chat_ |
config & | gamelist_ |
gui::label | title_ |
gui::textbox | entry_textbox_ |
gui::textbox | chat_textbox_ |
gui::menu | users_menu_ |
std::vector< std::string > | user_list_ |
std::string | selected_game_ |
result | result_ |
bool | gamelist_refresh_ |
Uint32 | lobby_clock_ |
Classes | |
struct | user_info |
Definition at line 72 of file multiplayer_ui.hpp.
enum mp::ui::result |
Definition at line 75 of file multiplayer_ui.hpp.
enum mp::ui::user_state |
mp::ui::ui | ( | game_display & | d, | |
const std::string & | title, | |||
const config & | cfg, | |||
chat & | c, | |||
config & | gamelist | |||
) |
Definition at line 231 of file multiplayer_ui.cpp.
References CVideo::getx(), CVideo::gety(), set_location(), gui::menu::set_numeric_keypress_selection(), users_menu_, and display::video().
void mp::ui::process_network | ( | ) |
Definition at line 264 of file multiplayer_ui.cpp.
References network::accept_connection(), accept_connections(), data, gamelist_refresh_, gamelist_updated(), lobby_clock_, game_config::lobby_refresh, LOG_NW, process_network_connection(), process_network_data(), process_network_error(), network::receive_data(), sock, and cursor::WAIT.
Referenced by run_lobby_loop().
ui::result mp::ui::get_result | ( | ) |
Definition at line 296 of file multiplayer_ui.cpp.
References result_.
Referenced by mp::connect::connect(), enter_connect_mode(), enter_create_mode(), enter_lobby_mode(), enter_wait_mode(), run_lobby_loop(), and mp::create::~create().
void mp::ui::set_location | ( | const SDL_Rect & | rect | ) | [virtual] |
Reimplemented from gui::widget.
Definition at line 355 of file multiplayer_ui.cpp.
References chat_, chat_textbox_, hide_children(), mp::chat::init_textbox(), initialized_, layout_children(), and gui::textbox::set_wrap().
Referenced by run_lobby_loop(), and ui().
int mp::ui::xscale | ( | int | x | ) | const [protected] |
Definition at line 310 of file multiplayer_ui.cpp.
References gui::widget::width(), and xscale_base.
Referenced by client_area(), layout_children(), and mp::lobby::layout_children().
int mp::ui::yscale | ( | int | y | ) | const [protected] |
Definition at line 315 of file multiplayer_ui.cpp.
References gui::widget::height(), and yscale_base.
Referenced by client_area(), layout_children(), and mp::lobby::layout_children().
SDL_Rect mp::ui::client_area | ( | ) | const [protected] |
Definition at line 320 of file multiplayer_ui.cpp.
References xscale(), and yscale().
Referenced by mp::wait::layout_children(), mp::lobby::layout_children(), mp::create::layout_children(), and mp::connect::layout_children().
game_display& mp::ui::disp | ( | ) | [inline, protected] |
Definition at line 104 of file multiplayer_ui.hpp.
References disp_.
Referenced by handle_event(), mp::wait::join_game(), mp::connect::load_game(), and mp::wait::process_network_data().
const config & mp::ui::game_config | ( | ) | const [protected] |
Definition at line 332 of file multiplayer_ui.cpp.
References game_config_.
Referenced by mp::lobby::gamelist_updated(), mp::create::get_parameters(), mp::create::hide_children(), mp::connect::load_game(), and mp::create::process_event().
void mp::ui::draw_contents | ( | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 337 of file multiplayer_ui.cpp.
References image::get_image(), hide_children(), scale_surface(), update_whole_screen(), and gui::widget::video().
void mp::ui::process_event | ( | ) | [protected, virtual] |
Reimplemented from events::handler.
Reimplemented in mp::connect, mp::create, mp::lobby, and mp::wait.
Definition at line 368 of file multiplayer_ui.cpp.
void mp::ui::handle_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 372 of file multiplayer_ui.cpp.
References _, config::add_child(), disp(), gui::menu::double_clicked(), handle_key_event(), gui::OK_CANCEL, gui::menu::selection(), network::send_data(), gui::dialog::set_textbox(), gui::dialog::show(), gui::dialog::textbox_text(), user_list_, and users_menu_.
void mp::ui::handle_key_event | ( | const SDL_KeyboardEvent & | event | ) | [protected, virtual] |
Definition at line 415 of file multiplayer_ui.cpp.
References mp::chat::add_message(), chat_, chat_textbox_, gui::textbox::clear(), entry_textbox_, utils::join(), preferences::login(), halo::remove(), gui::textbox::set_text(), text, gui::textbox::text(), mp::chat::update_textbox(), user_list_, and utils::word_completion().
Referenced by handle_event().
void mp::ui::add_chat_message | ( | const time_t & | time, | |
const std::string & | speaker, | |||
int | side, | |||
const std::string & | message, | |||
game_display::MESSAGE_TYPE | type = game_display::MESSAGE_PRIVATE | |||
) | [protected, virtual] |
Implements events::chat_handler.
Definition at line 397 of file multiplayer_ui.cpp.
References mp::chat::add_message(), chat_, chat_textbox_, and mp::chat::update_textbox().
Referenced by send_chat_message().
void mp::ui::send_chat_message | ( | const std::string & | message, | |
bool | allies_only = false | |||
) | [protected, virtual] |
Implements events::chat_handler.
Definition at line 403 of file multiplayer_ui.cpp.
References add_chat_message(), config::add_child(), data, preferences::login(), and network::send_data().
void mp::ui::process_message | ( | const config & | msg, | |
const bool | whisper = false | |||
) | [protected] |
Process chat messages.
Definition at line 446 of file multiplayer_ui.cpp.
References mp::chat::add_message(), chat_, chat_textbox_, preferences::is_friend(), preferences::is_ignored(), preferences::login(), message, sound::play_UI_sound(), game_config::sounds::receive_message, game_config::sounds::receive_message_friend, game_config::sounds::receive_message_highlight, game_config::sounds::receive_message_server, preferences::show_lobby_join(), mp::chat::update_textbox(), and utils::word_match().
Referenced by process_network_data().
void mp::ui::process_network_data | ( | const config & | data, | |
const network::connection | sock | |||
) | [protected, virtual] |
Reimplemented in mp::connect, mp::lobby, and mp::wait.
Definition at line 466 of file multiplayer_ui.cpp.
References config::apply_diff(), config::child(), lg::config, ERR_CF, gamelist_, gamelist_initialized_, gamelist_refresh_, gamelist_updated(), lobby_clock_, config::error::message, process_message(), network::send_data(), and cursor::WAIT.
Referenced by process_network(), mp::wait::process_network_data(), mp::lobby::process_network_data(), and mp::connect::process_network_data().
void mp::ui::process_network_error | ( | network::error & | error | ) | [protected, virtual] |
Reimplemented in mp::connect.
Definition at line 495 of file multiplayer_ui.cpp.
References ERR_NW, and network::error::message.
Referenced by process_network().
virtual bool mp::ui::accept_connections | ( | ) | [inline, protected, virtual] |
Reimplemented in mp::connect.
Definition at line 138 of file multiplayer_ui.hpp.
Referenced by process_network().
void mp::ui::process_network_connection | ( | const network::connection | sock | ) | [protected, virtual] |
Reimplemented in mp::connect.
Definition at line 503 of file multiplayer_ui.cpp.
References LOG_NW.
Referenced by process_network(), and mp::connect::process_network_connection().
void mp::ui::hide_children | ( | bool | hide = true |
) | [protected, virtual] |
Reimplemented in mp::connect, mp::create, mp::lobby, and mp::wait.
Definition at line 508 of file multiplayer_ui.cpp.
References chat_textbox_, entry_textbox_, gui::scrollarea::hide(), gui::widget::hide(), title_, and users_menu_.
Referenced by draw_contents(), mp::wait::hide_children(), mp::lobby::hide_children(), mp::create::hide_children(), mp::connect::hide_children(), and set_location().
void mp::ui::layout_children | ( | const SDL_Rect & | rect | ) | [protected, virtual] |
Reimplemented in mp::connect, mp::create, mp::lobby, and mp::wait.
Definition at line 518 of file multiplayer_ui.cpp.
References chat_textbox_, entry_textbox_, gui::widget::set_height(), gui::textbox::set_location(), gui::widget::set_location(), gui::menu::set_max_height(), gui::menu::set_max_width(), gui::widget::set_measurements(), gui::widget::set_width(), title_, umenu_style, users_menu_, xscale(), and yscale().
Referenced by mp::wait::layout_children(), mp::lobby::layout_children(), mp::create::layout_children(), mp::connect::layout_children(), and set_location().
ui::result mp::ui::set_result | ( | ui::result | res | ) | [protected] |
Definition at line 301 of file multiplayer_ui.cpp.
References result_.
Referenced by mp::wait::join_game(), mp::connect::load_game(), mp::wait::process_event(), mp::lobby::process_event(), mp::create::process_event(), mp::connect::process_event(), mp::wait::process_network_data(), and mp::connect::process_network_data().
void mp::ui::set_selected_game | ( | const std::string | game_name | ) | [protected] |
Definition at line 665 of file multiplayer_ui.cpp.
References gui::menu::move_selection(), selected_game_, preferences::sort_list(), and users_menu_.
Referenced by mp::lobby::process_event().
void mp::ui::gamelist_updated | ( | bool | silent = true |
) | [protected, virtual] |
Reimplemented in mp::lobby.
Definition at line 588 of file multiplayer_ui.cpp.
References FRIEND, GAME, mp::ui::user_info::game_id, gamelist_, preferences::get(), config::get_children(), HELP_STRING_SEPARATOR, preferences::iconize_list(), IGNORED, IMAGE_PREFIX, IMG_TEXT_SEPARATOR, LOBBY, mp::ui::user_info::location, preferences::login(), ME, mp::ui::user_info::name, NEUTRAL, mp::ui::user_info::relation, SEL_GAME, selected_game_, set_user_list(), set_user_menu_items(), preferences::sort_list(), utils::split(), and mp::ui::user_info::state.
Referenced by mp::create::create(), mp::lobby::gamelist_updated(), mp::lobby::process_event(), process_network(), process_network_data(), mp::connect::update_playerlist_state(), and mp::wait::wait().
void mp::ui::set_user_list | ( | const std::vector< std::string > & | list, | |
bool | silent | |||
) | [protected] |
Definition at line 679 of file multiplayer_ui.cpp.
References sound::play_UI_sound(), game_config::sounds::user_arrive, game_config::sounds::user_leave, and user_list_.
Referenced by gamelist_updated(), mp::wait::generate_menu(), and mp::connect::update_playerlist_state().
void mp::ui::set_user_menu_items | ( | const std::vector< std::string > & | list | ) | [protected] |
Definition at line 674 of file multiplayer_ui.cpp.
References gui::menu::set_items(), and users_menu_.
Referenced by gamelist_updated(), and mp::connect::update_playerlist_state().
config& mp::ui::gamelist | ( | ) | [inline, protected] |
Definition at line 167 of file multiplayer_ui.hpp.
References gamelist_.
Referenced by mp::lobby::gamelist_updated(), mp::wait::generate_menu(), and mp::connect::update_playerlist_state().
void mp::ui::append_to_title | ( | const std::string & | name | ) | [protected] |
Definition at line 692 of file multiplayer_ui.cpp.
References gui::label::get_text(), gui::label::set_text(), and title_.
Referenced by mp::wait::join_game(), and mp::connect::load_game().
const gui::label & mp::ui::title | ( | ) | const [protected] |
Definition at line 696 of file multiplayer_ui.cpp.
References title_.
Referenced by mp::wait::layout_children(), mp::lobby::layout_children(), and mp::create::layout_children().
const int mp::ui::xscale_base = 1024 [static, protected] |
Definition at line 98 of file multiplayer_ui.hpp.
Referenced by mp::lobby::layout_children(), and xscale().
const int mp::ui::yscale_base = 768 [static, protected] |
game_display& mp::ui::disp_ [protected] |
Definition at line 103 of file multiplayer_ui.hpp.
Referenced by disp(), mp::lobby::process_event(), and mp::create::process_event().
bool mp::ui::initialized_ [private] |
Set to true when the widgets are intialized.
Allows delayed initialization on first positioning.
Definition at line 175 of file multiplayer_ui.hpp.
Referenced by set_location().
bool mp::ui::gamelist_initialized_ [private] |
const hotkey::basic_handler mp::ui::hotkey_handler_ [private] |
Definition at line 179 of file multiplayer_ui.hpp.
const preferences::display_manager mp::ui::disp_manager_ [private] |
Definition at line 181 of file multiplayer_ui.hpp.
const config& mp::ui::game_config_ [private] |
chat& mp::ui::chat_ [private] |
Definition at line 187 of file multiplayer_ui.hpp.
Referenced by add_chat_message(), handle_key_event(), process_message(), and set_location().
config& mp::ui::gamelist_ [private] |
Definition at line 189 of file multiplayer_ui.hpp.
Referenced by gamelist(), gamelist_updated(), and process_network_data().
gui::label mp::ui::title_ [private] |
Definition at line 191 of file multiplayer_ui.hpp.
Referenced by append_to_title(), hide_children(), layout_children(), and title().
gui::textbox mp::ui::entry_textbox_ [private] |
Definition at line 193 of file multiplayer_ui.hpp.
Referenced by handle_key_event(), hide_children(), and layout_children().
gui::textbox mp::ui::chat_textbox_ [private] |
Definition at line 195 of file multiplayer_ui.hpp.
Referenced by add_chat_message(), handle_key_event(), hide_children(), layout_children(), process_message(), and set_location().
gui::menu mp::ui::users_menu_ [private] |
Definition at line 197 of file multiplayer_ui.hpp.
Referenced by handle_event(), hide_children(), layout_children(), set_selected_game(), set_user_menu_items(), and ui().
std::vector<std::string> mp::ui::user_list_ [private] |
Definition at line 199 of file multiplayer_ui.hpp.
Referenced by handle_event(), handle_key_event(), and set_user_list().
std::string mp::ui::selected_game_ [private] |
Definition at line 201 of file multiplayer_ui.hpp.
Referenced by gamelist_updated(), and set_selected_game().
result mp::ui::result_ [private] |
bool mp::ui::gamelist_refresh_ [private] |
Definition at line 205 of file multiplayer_ui.hpp.
Referenced by process_network(), and process_network_data().
Uint32 mp::ui::lobby_clock_ [private] |
Definition at line 207 of file multiplayer_ui.hpp.
Referenced by process_network(), and process_network_data().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |