1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

Merge pull request #2396 from Laserlicht/haptic-radial

haptic feedback on radial menu action
This commit is contained in:
Ivan Savenko 2023-07-24 00:48:47 +03:00 committed by GitHub
commit d0b2bdf0f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View File

@ -239,6 +239,11 @@ void InputHandler::stopTextInput()
textHandler->stopTextInput(); textHandler->stopTextInput();
} }
void InputHandler::hapticFeedback()
{
fingerHandler->hapticFeedback();
}
bool InputHandler::hasTouchInputDevice() const bool InputHandler::hasTouchInputDevice() const
{ {
return fingerHandler->hasTouchInputDevice(); return fingerHandler->hasTouchInputDevice();

View File

@ -63,6 +63,9 @@ public:
/// Ends any existing text input state /// Ends any existing text input state
void stopTextInput(); void stopTextInput();
/// do a haptic feedback
void hapticFeedback();
/// returns true if system has active touchscreen /// returns true if system has active touchscreen
bool hasTouchInputDevice() const; bool hasTouchInputDevice() const;

View File

@ -96,8 +96,6 @@ class InputSourceTouch
void emitPanningEvent(const SDL_TouchFingerEvent & tfinger); void emitPanningEvent(const SDL_TouchFingerEvent & tfinger);
void emitPinchEvent(const SDL_TouchFingerEvent & tfinger); void emitPinchEvent(const SDL_TouchFingerEvent & tfinger);
void hapticFeedback();
public: public:
InputSourceTouch(); InputSourceTouch();
@ -106,6 +104,8 @@ public:
void handleEventFingerDown(const SDL_TouchFingerEvent & current); void handleEventFingerDown(const SDL_TouchFingerEvent & current);
void handleEventFingerUp(const SDL_TouchFingerEvent & current); void handleEventFingerUp(const SDL_TouchFingerEvent & current);
void hapticFeedback();
void handleUpdate(); void handleUpdate();
bool hasTouchInputDevice() const; bool hasTouchInputDevice() const;

View File

@ -13,6 +13,7 @@
#include "Images.h" #include "Images.h"
#include "TextControls.h" #include "TextControls.h"
#include "../eventsSDL/InputHandler.h"
#include "../gui/CGuiHandler.h" #include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h" #include "../gui/WindowHandler.h"
#include "../render/IImage.h" #include "../render/IImage.h"
@ -137,5 +138,8 @@ void RadialMenu::gesture(bool on, const Point & initialPosition, const Point & f
// we need to close this window first so if action spawns a new window it won't be closed instead // we need to close this window first so if action spawns a new window it won't be closed instead
GH.windows().popWindows(1); GH.windows().popWindows(1);
if (item) if (item)
{
GH.input().hapticFeedback();
item->callback(); item->callback();
}
} }