Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef CONTROLLER_BASE_H_INCLUDED
00018 #define CONTROLLER_BASE_H_INCLUDED
00019
00020 #include "global.hpp"
00021
00022 #include "hotkeys.hpp"
00023 #include "key.hpp"
00024
00025 #include "joystick.hpp"
00026
00027 #include "map.hpp"
00028
00029 class CVideo;
00030
00031 namespace events {
00032 class mouse_handler_base;
00033 }
00034
00035 class controller_base : public hotkey::command_executor, public events::handler
00036 {
00037 public:
00038 controller_base(int ticks, const config& game_config, CVideo& video);
00039 virtual ~controller_base();
00040
00041 void play_slice(bool is_delay_enabled = true);
00042
00043 int get_ticks();
00044
00045 protected:
00046
00047
00048
00049
00050 virtual void slice_before_scroll();
00051
00052
00053
00054
00055 virtual void slice_end();
00056
00057
00058
00059
00060 virtual events::mouse_handler_base& get_mouse_handler_base() = 0;
00061
00062
00063
00064 virtual display& get_display() = 0;
00065
00066
00067
00068
00069
00070
00071
00072
00073 virtual bool have_keyboard_focus();
00074
00075
00076
00077
00078
00079
00080
00081 bool handle_scroll(CKey& key, int mousex, int mousey, int mouse_flags, double joystickx, double joysticky);
00082
00083
00084
00085
00086
00087
00088 void handle_event(const SDL_Event& event);
00089
00090
00091
00092
00093 virtual void process_focus_keydown_event(const SDL_Event& event);
00094
00095
00096
00097
00098
00099 virtual void process_keydown_event(const SDL_Event& event);
00100
00101
00102
00103
00104
00105 virtual void process_keyup_event(const SDL_Event& event);
00106
00107
00108
00109
00110
00111 virtual void post_mouse_press(const SDL_Event& event);
00112
00113 virtual void show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu);
00114
00115 virtual bool in_context_menu(hotkey::HOTKEY_COMMAND command) const;
00116
00117 const config &get_theme(const config& game_config, std::string theme_name);
00118 const config& game_config_;
00119 const int ticks_;
00120 CKey key_;
00121 bool browse_;
00122 bool scrolling_;
00123 joystick_manager joystick_manager_;
00124
00125 };
00126
00127
00128 #endif