implement lime.ui.Haptic.vibrate(...) for iOS
-Basic implementation, but works-
This commit is contained in:
committed by
Joshua Granick
parent
a361b4681e
commit
fe13ea21f3
@@ -235,6 +235,7 @@
|
||||
<file name="src/system/System.mm" if="ios" />
|
||||
<file name="src/ui/DropEvent.cpp" />
|
||||
<file name="src/ui/GamepadEvent.cpp" />
|
||||
<file name="src/ui/Haptic.mm" if="ios" />
|
||||
<file name="src/ui/JoystickEvent.cpp" />
|
||||
<file name="src/ui/KeyEvent.cpp" />
|
||||
<file name="src/ui/MouseEvent.cpp" />
|
||||
|
||||
21
project/include/ui/Haptic.h
Normal file
21
project/include/ui/Haptic.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef LIME_UI_HAPTIC_H
|
||||
#define LIME_UI_HAPTIC_H
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
class Haptic {
|
||||
|
||||
public:
|
||||
#ifdef IPHONE
|
||||
static void Vibrate (int period, int duration);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <ui/FileDialog.h>
|
||||
#include <ui/Gamepad.h>
|
||||
#include <ui/GamepadEvent.h>
|
||||
#include <ui/Haptic.h>
|
||||
#include <ui/Joystick.h>
|
||||
#include <ui/JoystickEvent.h>
|
||||
#include <ui/KeyEvent.h>
|
||||
@@ -696,6 +697,13 @@ namespace lime {
|
||||
|
||||
}
|
||||
|
||||
void lime_haptic_vibrate (int period, int duration) {
|
||||
|
||||
#ifdef IPHONE
|
||||
Haptic::Vibrate(period, duration);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
value lime_image_encode (value buffer, int type, int quality, value bytes) {
|
||||
|
||||
@@ -1669,6 +1677,7 @@ namespace lime {
|
||||
DEFINE_PRIME1 (lime_gamepad_get_device_name);
|
||||
DEFINE_PRIME2 (lime_gzip_compress);
|
||||
DEFINE_PRIME2 (lime_gzip_decompress);
|
||||
DEFINE_PRIME2 (lime_haptic_vibrate);
|
||||
DEFINE_PRIME3v (lime_image_data_util_color_transform);
|
||||
DEFINE_PRIME6v (lime_image_data_util_copy_channel);
|
||||
DEFINE_PRIME7v (lime_image_data_util_copy_pixels);
|
||||
|
||||
15
project/src/ui/Haptic.mm
Normal file
15
project/src/ui/Haptic.mm
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <ui/Haptic.h>
|
||||
|
||||
#import <AudioToolbox/AudioServices.h>
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
void Haptic::Vibrate (int period, int duration) {
|
||||
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user