Ticket #8711: backends-lib.v1.patch
File backends-lib.v1.patch, 15.3 KB (added by , 17 years ago) |
---|
-
D:/programming/projects/gsoc/scummvm/backends/events/default/default-events.h
28 28 29 29 #include "common/stdafx.h" 30 30 #include "common/events.h" 31 #include "backends/events/generic/generic-events.h" 31 32 32 33 /* 33 34 At some point we will remove pollEvent from OSystem and change … … 41 42 use a subclass of EventProvider. 42 43 */ 43 44 44 class DefaultEventManager : public Common::EventManager {45 class DefaultEventManager : public GenericEventManager { 45 46 OSystem *_boss; 46 47 47 48 Common::Point _mousePos; -
D:/programming/projects/gsoc/scummvm/backends/events/generic/generic-events.cpp
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/events/default/default-events.cpp $ 22 * $Id: default-events.cpp 27831 2007-07-01 18:22:25Z fingolfin $ 23 * 24 */ 25 26 #if !defined(DISABLE_GENERIC_EVENTMANAGER) 27 28 #include "common/stdafx.h" 29 #include "common/config-manager.h" 30 #include "common/system.h" 31 #include "backends/events/generic/generic-events.h" 32 33 #include "engines/engine.h" 34 #include "gui/message.h" 35 36 GenericEventManager::GenericEventManager() { 37 38 } 39 40 Common::UserAction GenericEventManager::resolveUserAction() const { 41 Common::UserAction action; 42 // 43 return action; 44 } 45 46 Common::Button GenericEventManager::pollButton() const { 47 Common::Button btn; 48 // retrieves 49 return btn; 50 } 51 52 void GenericEventManager::registerEngineActions(std::set<Common::UserAction> actions) { 53 } 54 55 void GenericEventManager::registerGameActions(std::set<Common::UserAction> actions) { 56 } 57 58 void GenericEventManager::registerBackendButtons(std::set<Common::Button>) { 59 } 60 61 void GenericEventManager::checkMappings(bool engine) { 62 } 63 64 #endif // !defined(DISABLE_GENERIC_EVENTMANAGER) -
D:/programming/projects/gsoc/scummvm/backends/events/generic/generic-events.h
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #if !defined(BACKEND_EVENTS_GENERIC_H) && !defined(DISABLE_GENERIC_EVENTMANAGER) 24 #define BACKEND_EVENTS_GENERIC_H 25 26 #include "common/stdafx.h" 27 #include "common/events.h" 28 29 class GenericEventManager : public Common::EventManager { 30 31 Common::Point _mousePos; 32 std::set <Common::UserAction> _engineActions; 33 std::set <Common::UserAction> _gameActions; 34 std::set <Common::Button> _backendButtons; 35 36 public: 37 GenericEventManager(); 38 39 virtual Common::UserAction resolveUserAction() const; 40 41 virtual Common::Button pollButton() const; 42 virtual Common::Point getMousePos() const { return _mousePos; } 43 44 virtual void registerEngineActions(std::set<Common::UserAction>); 45 virtual void registerGameActions(std::set<Common::UserAction>); 46 47 protected: 48 49 virtual void registerBackendButtons(std::set<Common::Button>); 50 51 private: 52 53 void checkMappings(bool engine); 54 }; 55 56 #endif -
D:/programming/projects/gsoc/scummvm/common/buttons.h
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef COMMON_BUTTONS_H 24 #define COMMON_BUTTONS_H 25 26 #include "common/scummsys.h" 27 28 namespace Common { 29 30 enum ButtonCode { 31 BUTTON_INVALID = 0, 32 33 BUTTON_BACKSPACE = 8, 34 BUTTON_TAB = 9, 35 BUTTON_CLEAR = 12, 36 BUTTON_RETURN = 13, 37 BUTTON_PAUSE = 19, 38 BUTTON_ESCAPE = 27, 39 BUTTON_SPACE = 32, 40 BUTTON_EXCLAIM = 33, 41 BUTTON_QUOTEDBL = 34, 42 BUTTON_HASH = 35, 43 BUTTON_DOLLAR = 36, 44 BUTTON_AMPERSAND = 38, 45 BUTTON_QUOTE = 39, 46 BUTTON_LEFTPAREN = 40, 47 BUTTON_RIGHTPAREN = 41, 48 BUTTON_ASTERISK = 42, 49 BUTTON_PLUS = 43, 50 BUTTON_COMMA = 44, 51 BUTTON_MINUS = 45, 52 BUTTON_PERIOD = 46, 53 BUTTON_SLASH = 47, 54 BUTTON_0 = 48, 55 BUTTON_1 = 49, 56 BUTTON_2 = 50, 57 BUTTON_3 = 51, 58 BUTTON_4 = 52, 59 BUTTON_5 = 53, 60 BUTTON_6 = 54, 61 BUTTON_7 = 55, 62 BUTTON_8 = 56, 63 BUTTON_9 = 57, 64 BUTTON_COLON = 58, 65 BUTTON_SEMICOLON = 59, 66 BUTTON_LESS = 60, 67 BUTTON_EQUALS = 61, 68 BUTTON_GREATER = 62, 69 BUTTON_QUESTION = 63, 70 BUTTON_AT = 64, 71 72 BUTTON_LEFTBRACKET = 91, 73 BUTTON_BACKSLASH = 92, 74 BUTTON_RIGHTBRACKET= 93, 75 BUTTON_CARET = 94, 76 BUTTON_UNDERSCORE = 95, 77 BUTTON_BACKQUOTE = 96, 78 BUTTON_a = 97, 79 BUTTON_b = 98, 80 BUTTON_c = 99, 81 BUTTON_d = 100, 82 BUTTON_e = 101, 83 BUTTON_f = 102, 84 BUTTON_g = 103, 85 BUTTON_h = 104, 86 BUTTON_i = 105, 87 BUTTON_j = 106, 88 BUTTON_k = 107, 89 BUTTON_l = 108, 90 BUTTON_m = 109, 91 BUTTON_n = 110, 92 BUTTON_o = 111, 93 BUTTON_p = 112, 94 BUTTON_q = 113, 95 BUTTON_r = 114, 96 BUTTON_s = 115, 97 BUTTON_t = 116, 98 BUTTON_u = 117, 99 BUTTON_v = 118, 100 BUTTON_w = 119, 101 BUTTON_x = 120, 102 BUTTON_y = 121, 103 BUTTON_z = 122, 104 BUTTON_DELETE = 127, 105 106 // Numeric keypad 107 BUTTON_KP0 = 256, 108 BUTTON_KP1 = 257, 109 BUTTON_KP2 = 258, 110 BUTTON_KP3 = 259, 111 BUTTON_KP4 = 260, 112 BUTTON_KP5 = 261, 113 BUTTON_KP6 = 262, 114 BUTTON_KP7 = 263, 115 BUTTON_KP8 = 264, 116 BUTTON_KP9 = 265, 117 BUTTON_KP_PERIOD = 266, 118 BUTTON_KP_DIVIDE = 267, 119 BUTTON_KP_MULTIPLY = 268, 120 BUTTON_KP_MINUS = 269, 121 BUTTON_KP_PLUS = 270, 122 BUTTON_KP_ENTER = 271, 123 BUTTON_KP_EQUALS = 272, 124 125 // Arrows + Home/End pad 126 BUTTON_UP = 273, 127 BUTTON_DOWN = 274, 128 BUTTON_RIGHT = 275, 129 BUTTON_LEFT = 276, 130 BUTTON_INSERT = 277, 131 BUTTON_HOME = 278, 132 BUTTON_END = 279, 133 BUTTON_PAGEUP = 280, 134 BUTTON_PAGEDOWN = 281, 135 136 // Function keys 137 BUTTON_F1 = 282, 138 BUTTON_F2 = 283, 139 BUTTON_F3 = 284, 140 BUTTON_F4 = 285, 141 BUTTON_F5 = 286, 142 BUTTON_F6 = 287, 143 BUTTON_F7 = 288, 144 BUTTON_F8 = 289, 145 BUTTON_F9 = 290, 146 BUTTON_F10 = 291, 147 BUTTON_F11 = 292, 148 BUTTON_F12 = 293, 149 BUTTON_F13 = 294, 150 BUTTON_F14 = 295, 151 BUTTON_F15 = 296, 152 153 // Key state modifier keys 154 BUTTON_NUMLOCK = 300, 155 BUTTON_CAPSLOCK = 301, 156 BUTTON_SCROLLOCK = 302, 157 BUTTON_RSHIFT = 303, 158 BUTTON_LSHIFT = 304, 159 BUTTON_RCTRL = 305, 160 BUTTON_LCTRL = 306, 161 BUTTON_RALT = 307, 162 BUTTON_LALT = 308, 163 BUTTON_RMETA = 309, 164 BUTTON_LMETA = 310, 165 BUTTON_LSUPER = 311, // Left "Windows" key 166 BUTTON_RSUPER = 312, // Right "Windows" key 167 BUTTON_MODE = 313, // "Alt Gr" key 168 BUTTON_COMPOSE = 314, // Multi-key compose key 169 170 // Miscellaneous function keys 171 BUTTON_HELP = 315, 172 BUTTON_PRINT = 316, 173 BUTTON_SYSREQ = 317, 174 BUTTON_BREAK = 318, 175 BUTTON_MENU = 319, 176 BUTTON_POWER = 320, // Power Macintosh power key 177 BUTTON_EURO = 321, // Some european keyboards 178 BUTTON_UNDO = 322, // Atari keyboard has Undo 179 180 // Mouse buttons 181 BUTTON_MOUSE_LEFT = 400, 182 BUTTON_MOUSE_RIGHT = 401, 183 BUTTON_MOUSE_WHEEL = 402 184 185 // Device specific buttons go here 186 }; 187 188 /** 189 * Button status, as used in the UserAction struct. 190 */ 191 struct Button { 192 /** 193 * Abstract key code (will be the same for any given key regardless 194 * of modifiers being held at the same time. 195 * For example, this is the same for both 'A' and Shift-'A'. 196 * @todo Document which values are to be used for non-ASCII keys 197 * like F1-F10. For now, let's just say that our primary backend 198 * is the SDL one, and it uses the values SDL uses... so until 199 * we fix this, your best bet is to get a copy of SDL_keysym.h 200 * and look at that, if you want to find out a key code. 201 */ 202 ButtonCode code; 203 204 /** 205 * Status of the modifier keys. Bits are set in this for each 206 * pressed modifier 207 * @see KBD_CTRL, KBD_ALT, KBD_SHIFT 208 */ 209 byte flags; 210 211 /** 212 * True for the key down event, false for the key up event 213 */ 214 bool down; 215 216 Button(ButtonCode bc = BUTTON_INVALID, byte f = 0, bool down = true) { 217 code = bc; 218 flags = f; 219 } 220 221 void reset() { 222 code = BUTTON_INVALID; 223 flags = 0; 224 down = true; 225 } 226 }; 227 228 } // End of namespace Common 229 230 #endif -
D:/programming/projects/gsoc/scummvm/common/events.h
27 27 #define COMMON_EVENTS_H 28 28 29 29 #include "common/keyboard.h" 30 #include "common/buttons.h" 30 31 #include "common/rect.h" 31 32 #include "common/system.h" 32 33 #include "common/noncopyable.h" 33 34 35 #include <set> 36 34 37 namespace Common { 35 38 36 39 /** … … 117 120 Common::Point mouse; 118 121 }; 119 122 123 enum UserActionType { 124 // engines specific actions 125 kQuitUserAction, // *maybe* could replace EVENT_QUIT 126 kPredictiveDialogUserAction, 127 kOptionsDialogUserAction, 128 kSaveLoadDialogUserAction, 129 kPauseUserAction, 130 kInputUserAction, 131 132 // games specific actions 133 kMoveUserAction, 134 kUseUserAction 135 }; 120 136 137 struct UserAction { 138 UserActionType type; // an enum type, see below 139 String description; // Human readable description, for a GUI keymapping config dialog 140 Button defaultBtn; // an (optional) default key combo to be assigned to this; includes modifier state 141 }; 142 121 143 /** 122 144 * The EventManager provides user input events to the client code. 123 145 * In addition, it keeps track of the state of various input devices, … … 137 159 * Get the next event in the event queue. 138 160 * @param event point to an Event struct, which will be filled with the event data. 139 161 * @return true if an event was retrieved. 162 * @deprecated use pollAction instead 140 163 */ 141 164 virtual bool pollEvent(Common::Event &event) = 0; 142 165 143 166 167 virtual Common::UserAction resolveUserAction() const = 0; 168 169 144 170 /** Return the current key state */ 145 171 virtual Common::Point getMousePos() const = 0; 146 172 … … 148 174 * Return a bitmask with the button states: 149 175 * - bit 0: left button up=1, down=0 150 176 * - bit 1: right button up=1, down=0 177 * @deprecated use pollAction() which returns UserAction instead 151 178 */ 152 179 virtual int getButtonState() const = 0; 153 180 154 /** Get a bitmask with the current modifier state */ 181 /** 182 * Get a bitmask with the current modifier state 183 * @deprecated use pollAction() which returns UserAction instead 184 */ 155 185 virtual int getModifierState() const = 0; 156 186 157 187 /** 158 188 * Should the application terminate? Set to true if we 159 189 * received an EVENT_QUIT. 190 * @deprecated use pollAction().type == Common::kQuitUserAction instead 160 191 */ 161 192 virtual int shouldQuit() const = 0; 162 193 … … 166 197 // TODO: Keyboard repeat support? 167 198 168 199 // TODO: Consider removing OSystem::getScreenChangeID and 169 // replacing it by a generic getScreenChangeID method here 200 // replacing it by a generic getScreenChaneID method here 201 202 virtual void registerEngineActions(std::set<Common::UserAction>) = 0; 203 virtual void registerGameActions(std::set<Common::UserAction>) = 0; 204 205 protected: 206 207 /** 208 * Returns currently pressed button 209 */ 210 virtual Common::Button pollButton() const = 0; 211 212 213 virtual void registerBackendButtons(std::set<Common::Button>) = 0; 214 170 215 }; 171 216 172 217 } // End of namespace Common