#include <controller_base.hpp>


Public Member Functions | |
| controller_base (int ticks, const config &game_config, CVideo &video) | |
| virtual | ~controller_base () |
| void | play_slice (bool is_delay_enabled=true) |
| int | get_ticks () |
Protected Member Functions | |
| virtual void | slice_before_scroll () |
| Called by play_slice after events:: calls, but before processing scroll and other things like menu. | |
| virtual void | slice_end () |
| Called at the very end of play_slice. | |
| virtual events::mouse_handler_base & | get_mouse_handler_base ()=0 |
| Get a reference to a mouse handler member a derived class uses. | |
| virtual display & | get_display ()=0 |
| Get a reference to a display member a derived class uses. | |
| virtual bool | have_keyboard_focus () |
| Derived classes should override this to return false when arrow keys should not scroll the map, hotkeys not processed etc, for example when a textbox is active. | |
| bool | handle_scroll (CKey &key, int mousex, int mousey, int mouse_flags, double joystickx, double joysticky) |
| Handle scrolling by keyboard, joystick and moving mouse near map edges. | |
| void | handle_event (const SDL_Event &event) |
| Process mouse- and keypress-events from SDL. | |
| virtual void | process_focus_keydown_event (const SDL_Event &event) |
| Process keydown (only when the general map display does not have focus). | |
| virtual void | process_keydown_event (const SDL_Event &event) |
| Process keydown (always). | |
| virtual void | process_keyup_event (const SDL_Event &event) |
| Process keyup (always). | |
| virtual void | post_mouse_press (const SDL_Event &event) |
| Called after processing a mouse button up or down event Overridden in derived classes. | |
| virtual void | show_menu (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu) |
| virtual bool | in_context_menu (hotkey::HOTKEY_COMMAND command) const |
| const config & | get_theme (const config &game_config, std::string theme_name) |
Protected Attributes | |
| const config & | game_config_ |
| const int | ticks_ |
| CKey | key_ |
| bool | browse_ |
| bool | scrolling_ |
| joystick_manager | joystick_manager_ |
Definition at line 35 of file controller_base.hpp.
Definition at line 29 of file controller_base.cpp.
| controller_base::~controller_base | ( | ) | [virtual] |
Definition at line 40 of file controller_base.cpp.
| virtual display& controller_base::get_display | ( | ) | [protected, pure virtual] |
Get a reference to a display member a derived class uses.
Referenced by handle_event(), handle_scroll(), play_slice(), and show_menu().

| virtual events::mouse_handler_base& controller_base::get_mouse_handler_base | ( | ) | [protected, pure virtual] |
Get a reference to a mouse handler member a derived class uses.
Referenced by handle_event(), and play_slice().

| const config & controller_base::get_theme | ( | const config & | game_config, | |
| std::string | theme_name | |||
| ) | [protected] |
Definition at line 296 of file controller_base.cpp.
References ERR_DP, config::find_child(), and preferences::theme().
Referenced by handle_event(), play_controller::init(), and replay_controller::rebuild_replay_theme().


| int controller_base::get_ticks | ( | ) |
Definition at line 44 of file controller_base.cpp.
References ticks_.
| void controller_base::handle_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Process mouse- and keypress-events from SDL.
Not virtual but calls various virtual function to allow specialized behaviour of derived classes.
Implements events::handler.
Definition at line 48 of file controller_base.cpp.
References browse_, hotkey::button_event(), get_display(), get_mouse_handler_base(), get_theme(), hotkey::hat_event(), have_keyboard_focus(), gui::in_dialog(), hotkey::key_event(), events::mouse_handler_base::mouse_motion_event(), events::mouse_handler_base::mouse_press(), post_mouse_press(), process_focus_keydown_event(), process_keydown_event(), process_keyup_event(), and show_menu().

| bool controller_base::handle_scroll | ( | CKey & | key, | |
| int | mousex, | |||
| int | mousey, | |||
| int | mouse_flags, | |||
| double | joystickx, | |||
| double | joysticky | |||
| ) | [protected] |
Handle scrolling by keyboard, joystick and moving mouse near map edges.
Definition at line 138 of file controller_base.cpp.
References preferences::get(), get_display(), theme::object::get_location(), display::get_theme(), display::h(), have_keyboard_focus(), display::map_outside_area(), theme::menus(), preferences::middle_click_scrolls(), preferences::mouse_scroll_enabled(), preferences::mouse_scroll_threshold(), point_in_rect(), round_double(), display::scroll(), preferences::scroll_speed(), and display::w().
Referenced by play_slice().


| bool controller_base::have_keyboard_focus | ( | ) | [protected, virtual] |
Derived classes should override this to return false when arrow keys should not scroll the map, hotkeys not processed etc, for example when a textbox is active.
Definition at line 117 of file controller_base.cpp.
Referenced by handle_event(), and handle_scroll().

| bool controller_base::in_context_menu | ( | hotkey::HOTKEY_COMMAND | command | ) | const [protected, virtual] |
Definition at line 291 of file controller_base.cpp.
Referenced by editor::editor_controller::show_menu(), and show_menu().

| void controller_base::play_slice | ( | bool | is_delay_enabled = true |
) |
Definition at line 194 of file controller_base.cpp.
References browse_, display::delay(), display::draw(), get_display(), display::get_map(), get_mouse_handler_base(), joystick_manager::get_scroll_axis_pair(), handle_scroll(), theme::menu::items(), joystick_manager_, theme::object::location(), display::menu_pressed(), events::mouse_handler_base::mouse_motion(), events::mouse_handler_base::mouse_update(), display::mouseover_hex(), gamemap::on_board(), display::ONSCREEN_WARP, events::pump(), events::raise_draw_event(), events::raise_process_event(), screen_area(), display::scroll_to_tile(), scrolling_, show_menu(), slice_before_scroll(), slice_end(), and joystick_manager::update_highlighted_hex().
Referenced by playsingle_controller::handle_generic_event(), intf_delay(), playsingle_controller::linger(), editor::editor_controller::main_loop(), playsingle_controller::play_human_turn(), playmp_controller::play_human_turn(), playmp_controller::play_network_turn(), replay_controller::play_turn(), unit_animator::wait_for_end(), and unit_animator::wait_until().


| void controller_base::post_mouse_press | ( | const SDL_Event & | event | ) | [protected, virtual] |
Called after processing a mouse button up or down event Overridden in derived classes.
Definition at line 134 of file controller_base.cpp.
Referenced by handle_event().

| void controller_base::process_focus_keydown_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Process keydown (only when the general map display does not have focus).
Definition at line 122 of file controller_base.cpp.
Referenced by handle_event().

| void controller_base::process_keydown_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Process keydown (always).
Overridden in derived classes
Definition at line 126 of file controller_base.cpp.
Referenced by handle_event().

| void controller_base::process_keyup_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Process keyup (always).
Overridden in derived classes
Definition at line 130 of file controller_base.cpp.
Referenced by handle_event().

| void controller_base::show_menu | ( | const std::vector< std::string > & | items_arg, | |
| int | xloc, | |||
| int | yloc, | |||
| bool | context_menu | |||
| ) | [protected, virtual] |
Definition at line 272 of file controller_base.cpp.
References hotkey::command_executor::can_execute_command(), get_display(), hotkey::get_hotkey(), and in_context_menu().
Referenced by handle_event(), and play_slice().


| void controller_base::slice_before_scroll | ( | ) | [protected, virtual] |
Called by play_slice after events:: calls, but before processing scroll and other things like menu.
Definition at line 262 of file controller_base.cpp.
Referenced by play_slice().

| void controller_base::slice_end | ( | ) | [protected, virtual] |
Called at the very end of play_slice.
Definition at line 267 of file controller_base.cpp.
Referenced by play_slice().

bool controller_base::browse_ [protected] |
Definition at line 121 of file controller_base.hpp.
Referenced by playsingle_controller::after_human_turn(), playsingle_controller::before_human_turn(), playsingle_controller::can_execute_command(), play_controller::can_execute_command(), playsingle_controller::check_end_level(), play_controller::cycle_back_units(), play_controller::cycle_units(), playsingle_controller::end_turn(), playsingle_controller::end_unit_turn(), handle_event(), play_controller::init(), playsingle_controller::linger(), playmp_controller::linger(), playsingle_controller::play_ai_turn(), playsingle_controller::play_side(), playmp_controller::play_side(), play_slice(), playsingle_controller::playsingle_controller(), playsingle_controller::recall(), playsingle_controller::recruit(), playsingle_controller::repeat_recruit(), and playsingle_controller::unit_hold_position().
const config& controller_base::game_config_ [protected] |
Definition at line 118 of file controller_base.hpp.
Referenced by editor::editor_controller::editor_controller(), play_controller::init(), play_controller::load_game(), editor::editor_controller::preferences(), and replay_controller::rebuild_replay_theme().
joystick_manager controller_base::joystick_manager_ [protected] |
Definition at line 123 of file controller_base.hpp.
Referenced by play_slice().
CKey controller_base::key_ [protected] |
Definition at line 120 of file controller_base.hpp.
Referenced by editor::editor_controller::editor_controller().
bool controller_base::scrolling_ [protected] |
Definition at line 122 of file controller_base.hpp.
Referenced by play_slice().
const int controller_base::ticks_ [protected] |
Definition at line 119 of file controller_base.hpp.
Referenced by get_ticks(), play_controller::init(), replay_controller::init_gui(), playsingle_controller::init_gui(), play_controller::init_managers(), replay_controller::init_replay_display(), replay_controller::play_replay(), and playsingle_controller::play_scenario().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:13:29 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |