mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Unified game controller input with keyboard/mouse
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "CGuiHandler.h"
|
||||
#include "MouseButton.h"
|
||||
#include "WindowHandler.h"
|
||||
#include "gui/Shortcut.h"
|
||||
|
||||
#include "../../lib/Rect.h"
|
||||
|
||||
@@ -74,6 +75,12 @@ void EventDispatcher::dispatchShortcutPressed(const std::vector<EShortcut> & sho
|
||||
{
|
||||
bool keysCaptured = false;
|
||||
|
||||
if (vstd::contains(shortcutsVector, EShortcut::MOUSE_LEFT))
|
||||
dispatchMouseLeftButtonPressed(GH.getCursorPosition(), 0);
|
||||
|
||||
if (vstd::contains(shortcutsVector, EShortcut::MOUSE_RIGHT))
|
||||
dispatchShowPopup(GH.getCursorPosition(), 0);
|
||||
|
||||
for(auto & i : keyinterested)
|
||||
for(EShortcut shortcut : shortcutsVector)
|
||||
if(i->captureThisKey(shortcut))
|
||||
@@ -97,6 +104,12 @@ void EventDispatcher::dispatchShortcutReleased(const std::vector<EShortcut> & sh
|
||||
{
|
||||
bool keysCaptured = false;
|
||||
|
||||
if (vstd::contains(shortcutsVector, EShortcut::MOUSE_LEFT))
|
||||
dispatchMouseLeftButtonReleased(GH.getCursorPosition(), 0);
|
||||
|
||||
if (vstd::contains(shortcutsVector, EShortcut::MOUSE_RIGHT))
|
||||
dispatchClosePopup(GH.getCursorPosition());
|
||||
|
||||
for(auto & i : keyinterested)
|
||||
for(EShortcut shortcut : shortcutsVector)
|
||||
if(i->captureThisKey(shortcut))
|
||||
|
||||
Reference in New Issue
Block a user