22 #ifndef COMMON_KEYMAPPER_H 23 #define COMMON_KEYMAPPER_H 25 #include "common/scummsys.h" 27 #include "backends/keymapper/keymap.h" 29 #include "common/array.h" 30 #include "common/config-manager.h" 31 #include "common/events.h" 35 const char *
const kGuiKeymapName =
"gui";
36 const char *
const kGlobalKeymapName =
"global";
39 class DelayedEventSource;
41 class HardwareInputSet;
42 class KeymapperDefaultBindings;
120 Keymap::KeymapType enabledKeymapType()
const {
return _enabledKeymapType; }
143 void reloadKeymapMappings(
Keymap *keymap);
151 enum IncomingEventType {
152 kIncomingEventIgnored,
155 kIncomingEventInstant
159 kJoyAxisPressedTreshold = Common::JOYAXIS_MAX / 2,
160 kJoyAxisUnpressedTreshold = Common::JOYAXIS_MAX / 4
164 Keymap::KeymapType _enabledKeymapType;
168 bool _joystickAxisPreviouslyPressed[8];
170 Keymap::KeymapMatch getMappedActions(
const Event &event,
Keymap::ActionArray &actions, Keymap::KeymapType keymapType)
const;
173 IncomingEventType convertToIncomingEventType(
const Event &ev)
const;
175 void hardcodedEventMapping(
Event ev);
176 void resetInputState();
185 _keymapper(keymapper) {
187 _previousKeymapType = keymapper->enabledKeymapType();
192 _keymapper->setEnabledKeymapType(_previousKeymapType);
197 Keymap::KeymapType _previousKeymapType;
203 bool pollEvent(
Event &event)
override;
204 bool allowMapping()
const override;
209 void scheduleEvent(
const Event &ev, uint32 delayMillis);
212 struct DelayedEventsEntry {
213 const uint32 timerOffset;
215 DelayedEventsEntry(
const uint32 offset,
const Event ev) : timerOffset(offset), event(ev) { }
219 uint32 _delayedEffectiveTime;
224 #endif // #ifndef COMMON_KEYMAPPER_H
void cleanupGameKeymaps()
EventType
Definition: events.h:49
void setEnabledKeymapType(Keymap::KeymapType type)
void disableAllGameKeymaps()
Keymap * getKeymap(const String &id) const
Definition: keymapper.h:44
HardwareInput findHardwareInput(const Event &event)
void setGameKeymapState(const String &id, bool enable)
void addGlobalKeymap(Keymap *keymap)
Definition: keymapper.h:200
const KeymapArray & getKeymaps() const
Definition: keymapper.h:107
void addGameKeymap(Keymap *keymap)
Definition: algorithm.h:29
Definition: keymapper-defaults.h:32
Definition: config-manager.h:59
virtual bool mapEvent(const Event &ev, List< Event > &mappedEvents)
bool isEnabled() const
Definition: keymapper.h:130
Definition: keymapper.h:182
void registerHardwareInputSet(HardwareInputSet *inputs, KeymapperDefaultBindings *backendDefaultBindings)
void setEnabled(bool enabled)
Definition: keymapper.h:125