2
0
Michael 2 жил өмнө
parent
commit
da8bcdd2dd

+ 6 - 0
client/eventsSDL/InputSourceTouch.cpp

@@ -25,6 +25,9 @@
 #ifdef VCMI_ANDROID
 #include "../../lib/CAndroidVMHelper.h"
 #endif
+#ifdef VCMI_IOS
+#include "../ios/utils.h"
+#endif
 
 #include <SDL_events.h>
 #include <SDL_hints.h>
@@ -299,4 +302,7 @@ void InputSourceTouch::hapticFeedback() {
     CAndroidVMHelper vmHelper;
     vmHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "hapticFeedback");
 #endif
+#if defined(VCMI_IOS)
+    iOS_utils::hapticFeedback();
+#endif
 }

+ 2 - 0
client/ios/utils.h

@@ -15,4 +15,6 @@ double screenScale();
 
 void showLoadingIndicator();
 void hideLoadingIndicator();
+
+void hapticFeedback();
 }

+ 7 - 0
client/ios/utils.mm

@@ -43,4 +43,11 @@ void hideLoadingIndicator()
 	[indicator removeFromSuperview];
 	indicator = nil;
 }
+
+void hapticFeedback()
+{
+	UIImpactFeedbackGenerator *hapticGen = [[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleLight)];
+	[hapticGen impactOccurred];
+	hapticGen = NULL;
+}
 }