mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
EVENTS: Expose the primary global keymap builder
This commit is contained in:
parent
be388fd9b0
commit
8dd2b7ca39
@ -28,6 +28,7 @@
|
||||
#include "common/config-manager.h"
|
||||
#include "common/translation.h"
|
||||
#include "backends/events/default/default-events.h"
|
||||
#include "backends/keymapper/action.h"
|
||||
#include "backends/keymapper/keymapper.h"
|
||||
#include "backends/keymapper/remap-dialog.h"
|
||||
#include "backends/vkeybd/virtual-keyboard.h"
|
||||
@ -317,4 +318,52 @@ void DefaultEventManager::purgeMouseEvents() {
|
||||
_eventQueue = filteredQueue;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
|
||||
Common::Keymap *DefaultEventManager::getGlobalKeymap() {
|
||||
using namespace Common;
|
||||
|
||||
// Now create the global keymap
|
||||
Keymap *globalKeymap = new Keymap(Keymap::kKeymapTypeGlobal, kGlobalKeymapName);
|
||||
|
||||
Action *act;
|
||||
act = new Action("MENU", _("Menu"));
|
||||
act->addDefaultInputMapping("C+F5");
|
||||
act->setEvent(EVENT_MAINMENU);
|
||||
globalKeymap->addAction(act);
|
||||
|
||||
#ifdef ENABLE_VKEYBD
|
||||
act = new Action("VIRT", _("Display keyboard"));
|
||||
act->addDefaultInputMapping("C+F7");
|
||||
act->setEvent(EVENT_VIRTUAL_KEYBOARD);
|
||||
globalKeymap->addAction(act);
|
||||
#endif
|
||||
|
||||
act = new Action("REMP", _("Remap keys"));
|
||||
act->addDefaultInputMapping("C+F8");
|
||||
act->setEvent(EVENT_KEYMAPPER_REMAP);
|
||||
globalKeymap->addAction(act);
|
||||
|
||||
act = new Action("FULS", _("Toggle fullscreen"));
|
||||
act->addDefaultInputMapping("A+RETURN");
|
||||
act->setKeyEvent(KeyState(KEYCODE_RETURN, ASCII_RETURN, KBD_ALT));
|
||||
globalKeymap->addAction(act);
|
||||
|
||||
act = new Action("LCLK", _("Left Click"));
|
||||
act->setLeftClickEvent();
|
||||
globalKeymap->addAction(act);
|
||||
|
||||
act = new Action("MCLK", _("Middle Click"));
|
||||
act->setMiddleClickEvent();
|
||||
globalKeymap->addAction(act);
|
||||
|
||||
act = new Action("RCLK", _("Right Click"));
|
||||
act->setRightClickEvent();
|
||||
globalKeymap->addAction(act);
|
||||
|
||||
return globalKeymap;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(DISABLE_DEFAULT_EVENTMANAGER)
|
||||
|
@ -94,7 +94,8 @@ public:
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
// IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
|
||||
// this, please talk to tsoliman and/or LordHoto.
|
||||
virtual Common::Keymapper *getKeymapper() override { return _keymapper; }
|
||||
Common::Keymapper *getKeymapper() override { return _keymapper; }
|
||||
Common::Keymap *getGlobalKeymap() override;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -366,50 +366,15 @@ static void setupKeymapper(OSystem &system) {
|
||||
|
||||
// Query the backend for hardware keys and default bindings and register them
|
||||
HardwareInputSet *inputSet = system.getHardwareInputSet();
|
||||
const Common::KeymapperDefaultBindings *backendDefaultBindings = system.getKeymapperDefaultBindings();
|
||||
const KeymapperDefaultBindings *backendDefaultBindings = system.getKeymapperDefaultBindings();
|
||||
|
||||
mapper->registerHardwareInputSet(inputSet);
|
||||
mapper->registerBackendDefaultBindings(backendDefaultBindings);
|
||||
|
||||
// Now create the global keymap
|
||||
Keymap *primaryGlobalKeymap = new Keymap(Keymap::kKeymapTypeGlobal, kGlobalKeymapName);
|
||||
|
||||
Action *act;
|
||||
act = new Action("MENU", _("Menu"));
|
||||
act->addDefaultInputMapping("C+F5");
|
||||
act->setEvent(EVENT_MAINMENU);
|
||||
primaryGlobalKeymap->addAction(act);
|
||||
|
||||
#ifdef ENABLE_VKEYBD
|
||||
act = new Action("VIRT", _("Display keyboard"));
|
||||
act->addDefaultInputMapping("C+F7");
|
||||
act->setEvent(EVENT_VIRTUAL_KEYBOARD);
|
||||
primaryGlobalKeymap->addAction(act);
|
||||
#endif
|
||||
|
||||
act = new Action("REMP", _("Remap keys"));
|
||||
act->addDefaultInputMapping("C+F8");
|
||||
act->setEvent(EVENT_KEYMAPPER_REMAP);
|
||||
primaryGlobalKeymap->addAction(act);
|
||||
|
||||
act = new Action("FULS", _("Toggle fullscreen"));
|
||||
act->addDefaultInputMapping("A+RETURN");
|
||||
act->setKeyEvent(KeyState(KEYCODE_RETURN, ASCII_RETURN, KBD_ALT));
|
||||
primaryGlobalKeymap->addAction(act);
|
||||
|
||||
act = new Action("LCLK", _("Left Click"));
|
||||
act->setLeftClickEvent();
|
||||
primaryGlobalKeymap->addAction(act);
|
||||
|
||||
act = new Action("MCLK", _("Middle Click"));
|
||||
act->setMiddleClickEvent();
|
||||
primaryGlobalKeymap->addAction(act);
|
||||
|
||||
act = new Action("RCLK", _("Right Click"));
|
||||
act->setRightClickEvent();
|
||||
primaryGlobalKeymap->addAction(act);
|
||||
|
||||
mapper->addGlobalKeymap(primaryGlobalKeymap);
|
||||
Keymap *primaryGlobalKeymap = system.getEventManager()->getGlobalKeymap();
|
||||
if (primaryGlobalKeymap) {
|
||||
mapper->addGlobalKeymap(primaryGlobalKeymap);
|
||||
}
|
||||
|
||||
// Get the platform-specific global keymap (if it exists)
|
||||
Keymap *platformGlobalKeymap = system.getGlobalKeymap();
|
||||
|
@ -421,6 +421,7 @@ private:
|
||||
void dispatchPoll();
|
||||
};
|
||||
|
||||
class Keymap;
|
||||
class Keymapper;
|
||||
|
||||
/**
|
||||
@ -503,6 +504,7 @@ public:
|
||||
// replacing it by a generic getScreenChangeID method here
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
virtual Keymapper *getKeymapper() = 0;
|
||||
virtual Keymap *getGlobalKeymap() = 0;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
|
Loading…
x
Reference in New Issue
Block a user