Ticket #8711: backends-lib.v3.5.patch

File backends-lib.v3.5.patch, 23.8 KB (added by SF/sbatyuk, 13 years ago)

final patch with key mapper and virtual keyboard API skeletons

  • backends/events/default/default-events.cpp

     
    3535
    3636DefaultEventManager::DefaultEventManager(OSystem *boss) :
    3737        _boss(boss),
     38        _keyMapper(boss->getKeyMapper()),
     39        _virtualKeyboard(boss->getVirtualKeyboard()),
    3840        _buttonState(0),
    3941        _modifierState(0),
    4042        _shouldQuit(false) {
     
    5254        result = _boss->pollEvent(event);
    5355       
    5456        if (result) {
     57                // check if we have to resolve virtual keyboard event
     58                bool lbutton = event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_LBUTTONUP;
     59                if (_boss->getFeatureState(OSystem::kFeatureVirtualKeyboard) && _virtualKeyboard && lbutton) { // possibly a virtual keyboard event
     60                        _virtualKeyboard->resolve(event); // try to resolve a virtual keyboard event
     61                }
     62
     63                // check if we have to resolve key mapping
     64                if (_keyMapper) {
     65                        _keyMapper->resolve(event);
     66                }
     67
    5568                event.synthetic = false;
    5669                switch (event.type) {
    5770                case Common::EVENT_KEYDOWN:
     
    128141        return result;
    129142}
    130143
     144void DefaultEventManager::registerActions(const Common::ActionList actions) {
     145        if (_keyMapper) {
     146                _keyMapper->registerActions(actions);
     147        }
     148}
     149void DefaultEventManager::unregisterActions() {
     150        if (_keyMapper) {
     151                _keyMapper->unregisterActions();
     152        }
     153}
     154void DefaultEventManager::mapActions() {
     155        if (_keyMapper) {
     156                _keyMapper->mapActions();
     157        }
     158}
     159
     160
    131161#endif // !defined(DISABLE_DEFAULT_EVENTMANAGER)
  • backends/events/default/default-events.h

     
    4343
    4444class DefaultEventManager : public Common::EventManager {
    4545        OSystem *_boss;
     46        KeyMapper *_keyMapper;
     47        VirtualKeyboard *_virtualKeyboard;
    4648
    4749        Common::Point _mousePos;
    4850        int _buttonState;
     
    6769
    6870        virtual bool pollEvent(Common::Event &event);
    6971
     72        virtual void registerActions(const Common::ActionList);
     73        virtual void unregisterActions();
     74        virtual void mapActions();
     75
    7076        virtual Common::Point getMousePos() const { return _mousePos; }
    7177        virtual int getButtonState() const { return _buttonState; }
    7278        virtual int getModifierState() const { return _modifierState; }
  • backends/platform/sdl/sdl.cpp

     
    257257        memset(&_mouseCurState, 0, sizeof(_mouseCurState));
    258258
    259259        _inited = false;
     260
     261        _keyMapper = new KeyMapper();
     262        _virtualKeyboard = new VirtualKeyboard();
    260263}
    261264
    262265OSystem_SDL::~OSystem_SDL() {
     
    271274        delete _savefile;
    272275        delete _mixer;
    273276        delete _timer;
     277
     278        delete _keyMapper;
     279        delete _virtualKeyboard;
    274280}
    275281
    276282uint32 OSystem_SDL::getMillis() {
  • backends/platform/sdl/events.cpp

     
    444444        }
    445445        return false;
    446446}
     447KeyMapper *OSystem_SDL::getKeyMapper() {
     448        return _keyMapper;
     449}
    447450
     451VirtualKeyboard *OSystem_SDL::getVirtualKeyboard() {
     452        return _virtualKeyboard;
     453}
     454
    448455bool OSystem_SDL::remapKey(SDL_Event &ev, Common::Event &event) {
    449456#ifdef LINUPY
    450457        // On Yopy map the End button to quit
  • backends/platform/sdl/sdl-common.h

     
    131131        // Returns true if an event was retrieved.
    132132        virtual bool pollEvent(Common::Event &event); // overloaded by CE backend
    133133
     134        virtual KeyMapper *getKeyMapper();
     135
     136        virtual VirtualKeyboard *getVirtualKeyboard();
     137
    134138        // Set function that generates samples
    135139        typedef void (*SoundProc)(void *param, byte *buf, int len);
    136140        virtual bool setSoundCallback(SoundProc proc, void *param); // overloaded by CE backend
     
    411415        virtual bool remapKey(SDL_Event &ev, Common::Event &event);
    412416
    413417        void handleScalerHotkeys(const SDL_KeyboardEvent &key);
     418
     419private:
     420        KeyMapper *_keyMapper;
     421        VirtualKeyboard *_virtualKeyboard;
     422
    414423};
    415424
    416425#endif
  • backends/platform/common/key-mapper.h

     
     1/* scummvm_current - Graphic Adventure Engine
     2 *
     3 * scummvm_current 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_KEY_MAPPER_H
     24#define COMMON_KEY_MAPPER_H
     25
     26#include "common/stdafx.h"
     27#include "common/scummsys.h"
     28#include "common/keyboard.h"
     29#include "common/events.h"
     30
     31#include "common/hashmap.h"
     32
     33typedef Common::HashMap<Common::KeyState, Common::UserAction, Common::KeyState_Hash> KeyActionMap;
     34
     35/**
     36 * Default key mapper implementation, base class for custom extensions.
     37 */
     38class KeyMapper {
     39
     40public:
     41
     42        KeyMapper();
     43        ~KeyMapper();
     44
     45        /**
     46         * Registers engine and game supported actions to be mapped.
     47         */
     48        virtual void registerActions(const Common::ActionList actions);
     49
     50        /**
     51         * Clears currently registered actions and their corresponding mappings.
     52         */
     53        virtual void unregisterActions();
     54
     55        /**
     56         * Opens a dialog window to map currently registered actions.
     57         */
     58        virtual void mapActions();
     59
     60        /**
     61         * Tries to find a corresponding mapping for event.kbd. If successful,
     62         * replaces the event.kbd with a defaultKey from mapped action. If mapped action
     63         * type is not Common::EVENT_INVALID, also substitutes the event.type.
     64         */
     65        void resolve(Common::Event &event);
     66
     67private:
     68        bool _registered;
     69        Common::ActionList _supportedActions;
     70        KeyActionMap _mappings; // available keys and action mappings
     71};
     72
     73#endif
  • backends/platform/common/virtual-keyboard.cpp

     
     1/* scummvm_current - Graphic Adventure Engine
     2 *
     3 * scummvm_current 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#include "backends/platform/common/virtual-keyboard.h"
     24
     25VirtualKeyboard::VirtualKeyboard() {
     26}
     27
     28VirtualKeyboard::~VirtualKeyboard() {
     29}
     30
     31void VirtualKeyboard::resolve(Common::Event &event) {
     32}
  • backends/platform/common/virtual-keyboard.h

     
     1/* scummvm_current - Graphic Adventure Engine
     2 *
     3 * scummvm_current 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_VIRTUAL_KEYBOARD_H
     24#define COMMON_VIRTUAL_KEYBOARD_H
     25
     26#include "common/stdafx.h"
     27#include "common/scummsys.h"
     28#include "common/events.h"
     29
     30/**
     31 * Default virtual keyboard implementation, base class for custom extensions.
     32 */
     33class VirtualKeyboard {
     34
     35public:
     36       
     37        VirtualKeyboard();
     38        ~VirtualKeyboard();
     39
     40        /**
     41         * For all mouse click events checks whether the click is 
     42         * in the screen range of virtual keyboard. This being true,
     43         * figures out what virtual button was clicked and substitutes
     44         * the mouse data in event with fake key data.
     45         */
     46        virtual void resolve(Common::Event &event);
     47};
     48
     49#endif
  • backends/platform/common/key-mapper.cpp

     
     1/* scummvm_current - Graphic Adventure Engine
     2 *
     3 * scummvm_current 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#include "backends/platform/common/key-mapper.h"
     24
     25KeyMapper::KeyMapper() :
     26        _registered(false) {
     27}
     28
     29KeyMapper::~KeyMapper() {
     30}
     31
     32void KeyMapper::registerActions(const Common::ActionList supportedActions) {
     33        this->unregisterActions();
     34        _supportedActions = supportedActions;
     35        for (Common::ActionList::iterator mIt = _supportedActions.begin(); mIt != _supportedActions.end(); mIt++) {
     36                // actions are mapped to default keys to substitute later the type of event
     37                _mappings[mIt->defaultKey] = *mIt;
     38        }
     39        // open the keys dialog or look up mappings in the tables for the rest of actions
     40        // ...
     41        _registered = true;
     42}
     43
     44void KeyMapper::unregisterActions() {
     45        _supportedActions.clear();
     46        _mappings.clear();
     47        _registered = false;
     48}
     49
     50void KeyMapper::mapActions() {
     51}
     52
     53void KeyMapper::resolve(Common::Event &event) {
     54        if (!_registered || _mappings.empty()) {
     55                return;
     56        }
     57       
     58        if (_mappings.contains(event.kbd)) {
     59                event.kbd = _mappings[event.kbd].defaultKey;
     60                if (_mappings[event.kbd].type != Common::EVENT_INVALID) {
     61                        event.type = _mappings[event.kbd].type;
     62                }
     63        }
     64}
  • backends/platform/common/module.mk

     
     1MODULE := backends/platform/common
     2
     3MODULE_OBJS := \
     4        key-mapper.o \
     5        virtual-keyboard.o
     6
     7MODULE_DIRS += \
     8        backends/platform/common/
     9
     10# We don't use the rules.mk here on purpose
     11OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
  • common/keyboard.h

     
    259259                keycode = KEYCODE_INVALID;
    260260                ascii = flags = 0;
    261261        }
     262
     263        bool operator <(const KeyState keyState) const {
     264                bool result;
     265                if (keycode != keyState.keycode) {
     266                        result = keycode < keyState.keycode;
     267                } else {
     268                        result = flags < keyState.flags;
     269                }
     270
     271                return result;
     272        }
     273
     274        bool operator ==(const KeyState keyState) const {
     275                return (keycode == keyState.keycode) && (flags == keyState.flags);
     276        }
     277
     278        uint hash() const {
     279                return 0;
     280        }
     281
    262282};
    263283
     284struct KeyState_Hash {
     285        uint operator()(const KeyState& ks) const { return ks.hash(); }
     286};
     287
     288
    264289} // End of namespace Common
    265290
    266291#endif
  • common/system.h

     
    3131#include "common/noncopyable.h"
    3232#include "common/rect.h"
    3333
     34#include "backends/platform/common/key-mapper.h"
     35#include "backends/platform/common/virtual-keyboard.h"
     36
    3437namespace Audio {
    3538        class Mixer;
    3639}
     
    724727         */
    725728        virtual bool pollEvent(Common::Event &event) = 0;
    726729
     730        virtual KeyMapper *getKeyMapper() { return NULL; }
     731
     732        virtual VirtualKeyboard *getVirtualKeyboard() { return NULL; }
     733
    727734public:
     735
    728736        /** Get the number of milliseconds since the program was started. */
    729737        virtual uint32 getMillis() = 0;
    730738
     
    743751         */
    744752        virtual Common::EventManager *getEventManager();
    745753
     754
    746755        //@}
    747756
    748757
     
    894903         * refer to the SaveFileManager documentation.
    895904         */
    896905        virtual Common::SaveFileManager *getSavefileManager() = 0;
    897 
    898906        //@}
    899907};
    900908
  • common/events.h

     
    2828
    2929#include "common/keyboard.h"
    3030#include "common/rect.h"
    31 #include "common/system.h"
    3231#include "common/noncopyable.h"
    3332
     33#include "common/list.h"
     34
    3435namespace Common {
    3536
    3637/**
     
    4344 *       indicates which button was pressed.
    4445 */
    4546enum EventType {
     47
     48        EVENT_INVALID = 0,
    4649        /** A key was pressed, details in Event::kbd. */
    4750        EVENT_KEYDOWN = 1,
    4851        /** A key was released, details in Event::kbd. */
     
    107110          * Keyboard data; only valid for keyboard events (EVENT_KEYDOWN and
    108111          * EVENT_KEYUP). For all other event types, content is undefined.
    109112          */
    110         KeyState kbd;
     113        Common::KeyState kbd;
    111114        /**
    112115         * The mouse coordinates, in virtual screen coordinates. Only valid
    113116         * for mouse events.
     
    115118         * screen area as defined by the most recent call to initSize().
    116119         */
    117120        Common::Point mouse;
     121
     122        Event(Common::EventType et = Common::EVENT_INVALID, bool s = false,
     123                Common::KeyState ks = Common::KeyState(), Common::Point p = Common::Point()) {
     124               
     125                type = et;
     126                synthetic = s;
     127                kbd = ks;
     128                mouse = p;
     129        }
     130
     131        void reset() {
     132                type = Common::EVENT_INVALID;
     133                synthetic = false;
     134                kbd = Common::KeyState();
     135                mouse = Common::Point();
     136        }
    118137};
    119138
     139enum Priority {
     140        PRIORITY_HIGHEST,
     141        PRIORITY_HIGH,
     142        PRIORITY_NORMAL,
     143        PRIORITY_LOW,
     144        PRIORITY_LOWEST
     145};
    120146
     147
     148struct UserAction {
     149
     150        /**
     151         * Default key used in the egines an games for this action.
     152         */
     153        Common::KeyState defaultKey;
     154
     155        /**
     156         * Event type like quit, save/load, etc.
     157         */
     158        Common::EventType type;
     159
     160        /**
     161         * Human readable description for a GUI keymapping config dialog
     162         */
     163        String description;
     164
     165        /**
     166         * Mapping priority. Actions with higher priority will be given preference for mapping
     167         * in case of limited inputs.
     168         */
     169        Common::Priority priority;
     170
     171        UserAction(Common::KeyState ks = Common::KeyState(Common::KEYCODE_ESCAPE),
     172                Common::EventType et = Common::EVENT_KEYDOWN, String d = "Action name",
     173                Common::Priority p = Common::PRIORITY_NORMAL) {
     174               
     175                defaultKey = ks;
     176                type = et;
     177                description = d;
     178                priority = p;
     179        }
     180
     181        UserAction(Common::KeyState ks, String d, Common::Priority p = Common::PRIORITY_NORMAL) {
     182                defaultKey = ks;
     183                type = Common::EVENT_INVALID;
     184                description = d;
     185                priority = p;
     186        }
     187
     188};
     189
     190typedef Common::List<Common::UserAction> ActionList;
     191
    121192/**
    122193 * The EventManager provides user input events to the client code.
    123194 * In addition, it keeps track of the state of various input devices,
     
    166237        // TODO: Keyboard repeat support?
    167238       
    168239        // TODO: Consider removing OSystem::getScreenChangeID and
    169         // replacing it by a generic getScreenChangeID method here
     240        // replacing it by a generic getScreenChaneID method here
     241
     242        // @see backends/platform/common/key-mapper.h
     243        virtual void registerActions(const ActionList) = 0;
     244
     245        // @see backends/platform/common/key-mapper.h
     246        virtual void unregisterActions() = 0;
     247
     248        // @see backends/platform/common/key-mapper.h
     249        virtual void mapActions() = 0;
     250
    170251};
    171252
    172253} // End of namespace Common
  • common/list.h

     
    3333 * Simple double linked list, modeled after the list template of the standard
    3434 * C++ library.
    3535 */
    36 template <class T>
     36template <class t_T>
    3737class List {
    3838protected:
    3939#if defined (_WIN32_WCE) || defined (_MSC_VER)
     
    4545                NodeBase *_next;
    4646        };
    4747       
    48         template <class T2>
     48        template <class t_T2>
    4949        struct Node : public NodeBase {
    50                 T2 _data;
     50                t_T2 _data;
    5151               
    52                 Node(const T2 &x) : _data(x) {}
     52                Node(const t_T2 &x) : _data(x) {}
    5353        };
    5454
    55         template <class T2>
     55        template <class t_T2>
    5656        class Iterator {
    57                 friend class List<T>;
     57                friend class List<t_T>;
    5858                NodeBase *_node;
    5959
    6060#if !defined (__WINSCW__)
     
    6767                Iterator() : _node(0) {}
    6868
    6969                // Prefix inc
    70                 Iterator<T2> &operator++() {
     70                Iterator<t_T2> &operator++() {
    7171                        if (_node)
    7272                                _node = _node->_next;
    7373                        return *this;
    7474                }
    7575                // Postfix inc
    76                 Iterator<T2> operator++(int) {
     76                Iterator<t_T2> operator++(int) {
    7777                        Iterator tmp(_node);
    7878                        ++(*this);
    7979                        return tmp;
    8080                }
    8181                // Prefix dec
    82                 Iterator<T2> &operator--() {
     82                Iterator<t_T2> &operator--() {
    8383                        if (_node)
    8484                                _node = _node->_prev;
    8585                        return *this;
    8686                }
    8787                // Postfix dec
    88                 Iterator<T2> operator--(int) {
     88                Iterator<t_T2> operator--(int) {
    8989                        Iterator tmp(_node);
    9090                        --(*this);
    9191                        return tmp;
    9292                }
    93                 T2& operator*() const {
     93                t_T2& operator*() const {
    9494                        assert(_node);
    9595#if (__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)
    96                         return static_cast<List<T>::Node<T2> *>(_node)->_data;
     96                        return static_cast<List<t_T>::Node<t_T2> *>(_node)->_data;
    9797#else
    98                         return static_cast<Node<T2>*>(_node)->_data;
     98                        return static_cast<Node<t_T2>*>(_node)->_data;
    9999#endif
    100100                }
    101                 T2* operator->() const {
     101                t_T2* operator->() const {
    102102                        return &(operator*());
    103103                }
    104104               
    105                 bool operator==(const Iterator<T2>& x) const {
     105                bool operator==(const Iterator<t_T2>& x) const {
    106106                        return _node == x._node;
    107107                }
    108108               
    109                 bool operator!=(const Iterator<T2>& x) const {
     109                bool operator!=(const Iterator<t_T2>& x) const {
    110110                        return _node != x._node;
    111111                }
    112112        };
     
    114114        NodeBase *_anchor;
    115115
    116116public:
    117         typedef Iterator<T>                     iterator;
    118         typedef Iterator<const T>       const_iterator;
     117        typedef Iterator<t_T>                   iterator;
     118        typedef Iterator<const t_T>     const_iterator;
    119119
    120         typedef T value_type;
     120        typedef t_T value_type;
    121121
    122122public:
    123123        List() {
     
    125125                _anchor->_prev = _anchor;
    126126                _anchor->_next = _anchor;
    127127        }
    128         List(const List<T>& list) {
     128        List(const List<t_T>& list) {
    129129                _anchor = new NodeBase;
    130130                _anchor->_prev = _anchor;
    131131                _anchor->_next = _anchor;
     
    138138                delete _anchor;
    139139        }
    140140
    141         void push_front(const T& element) {
     141        void push_front(const t_T& element) {
    142142                insert(begin(), element);
    143143        }
    144144
    145         void push_back(const T& element) {
     145        void push_back(const t_T& element) {
    146146                insert(end(), element);
    147147        }
    148148
    149         void insert(iterator pos, const T& element) {
    150                 NodeBase *newNode = new Node<T>(element);
     149        void insert(iterator pos, const t_T& element) {
     150                NodeBase *newNode = new Node<t_T>(element);
    151151               
    152152                newNode->_next = pos._node;
    153153                newNode->_prev = pos._node->_prev;
     
    166166
    167167                NodeBase *next = pos._node->_next;
    168168                NodeBase *prev = pos._node->_prev;
    169                 Node<T> *node = static_cast<Node<T> *>(pos._node);
     169                Node<t_T> *node = static_cast<Node<t_T> *>(pos._node);
    170170                prev->_next = next;
    171171                next->_prev = prev;
    172172                delete node;
     
    178178
    179179                NodeBase *next = pos._node->_next;
    180180                NodeBase *prev = pos._node->_prev;
    181                 Node<T> *node = static_cast<Node<T> *>(pos._node);
     181                Node<t_T> *node = static_cast<Node<t_T> *>(pos._node);
    182182                prev->_next = next;
    183183                next->_prev = prev;
    184184                delete node;
     
    192192                return last;
    193193        }
    194194
    195         void remove(const T &val) {
     195        void remove(const t_T &val) {
    196196                iterator i = begin();
    197197                while (i != end())
    198198                        if (val == i.operator*())
     
    202202        }
    203203
    204204
    205         List<T>& operator  =(const List<T>& list) {
     205        List<t_T>& operator  =(const List<t_T>& list) {
    206206                if (this != &list) {
    207207                        iterator i;
    208208                        const_iterator j;
    209209
    210210                        for (i = begin(), j = list.begin();  (i != end()) && (j != list.end()) ; ++i, ++j) {
    211                                 static_cast<Node<T> *>(i._node)->_data = static_cast<Node<T> *>(j._node)->_data;
     211                                static_cast<Node<t_T> *>(i._node)->_data = static_cast<Node<t_T> *>(j._node)->_data;
    212212                        }
    213213
    214214                        if (i == end())
  • engines/sky/sky.h

     
    2727#define SKY_H
    2828
    2929#include "common/stdafx.h"
     30#include "common/keyboard.h"
    3031#include "common/events.h"
     32#include "common/system.h"
    3133#include "engines/engine.h"
    3234
    3335namespace Sky {
  • engines/sky/sky.cpp

     
    183183
    184184SkyEngine::SkyEngine(OSystem *syst)
    185185        : Engine(syst), _fastMode(0), _debugger(0) {
     186
     187        Common::ActionList actions;
     188
     189        Common::KeyState key = Common::KeyState(Common::KEYCODE_F5);
     190        Common::UserAction action = Common::UserAction(key, "Menu");
     191        actions.push_back(action);
     192       
     193        key = Common::KeyState(Common::KEYCODE_ESCAPE);
     194        action = Common::UserAction(key, "Esc");
     195        actions.push_back(action);
     196
     197        key = Common::KeyState(Common::KEYCODE_p);
     198        action = Common::UserAction(key, "Pause");
     199        actions.push_back(action);
     200
     201        _eventMan->registerActions(actions);
     202        _eventMan->mapActions();
    186203}
    187204
    188205SkyEngine::~SkyEngine() {