mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 18:52:44 +01:00
parent
5d5ce370f1
commit
1f7e7e2816
@ -21,42 +21,50 @@ package mobile
|
||||
//
|
||||
// #import <CoreHaptics/CoreHaptics.h>
|
||||
//
|
||||
// static CHHapticEngine* engine;
|
||||
//
|
||||
// static void initializeVibrate(void) {
|
||||
// static id initializeHapticEngine(void) {
|
||||
// if (@available(iOS 13.0, *)) {
|
||||
// if (!CHHapticEngine.capabilitiesForHardware.supportsHaptics) {
|
||||
// return;
|
||||
// return nil;
|
||||
// }
|
||||
//
|
||||
// NSError* error = nil;
|
||||
// engine = [[CHHapticEngine alloc] initAndReturnError:&error];
|
||||
// CHHapticEngine* engine = [[CHHapticEngine alloc] initAndReturnError:&error];
|
||||
// if (error) {
|
||||
// return;
|
||||
// return nil;
|
||||
// }
|
||||
//
|
||||
// [engine startAndReturnError:&error];
|
||||
// if (error) {
|
||||
// return;
|
||||
// return nil;
|
||||
// }
|
||||
// return engine;
|
||||
// }
|
||||
// return nil;
|
||||
// }
|
||||
//
|
||||
// static void vibrate(double duration) {
|
||||
// if (@available(iOS 13.0, *)) {
|
||||
// static BOOL initializeHapticEngineCalled = NO;
|
||||
// static CHHapticEngine* engine = nil;
|
||||
// if (!initializeHapticEngineCalled) {
|
||||
// engine = (CHHapticEngine*)initializeHapticEngine();
|
||||
// initializeHapticEngineCalled = YES;
|
||||
// }
|
||||
// if (!engine) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// @autoreleasepool {
|
||||
// NSDictionary* hapticDict = @{
|
||||
// CHHapticPatternKeyPattern: @[
|
||||
// (id<NSCopying>)(CHHapticPatternKeyPattern): @[
|
||||
// @{
|
||||
// CHHapticPatternKeyEvent: @{
|
||||
// CHHapticPatternKeyEventType:CHHapticEventTypeHapticContinuous,
|
||||
// CHHapticPatternKeyTime:@0.0,
|
||||
// CHHapticPatternKeyEventDuration:[NSNumber numberWithDouble:duration],
|
||||
// CHHapticPatternKeyEventParameters:@[
|
||||
// (id<NSCopying>)(CHHapticPatternKeyEvent): @{
|
||||
// (id<NSCopying>)(CHHapticPatternKeyEventType):CHHapticEventTypeHapticContinuous,
|
||||
// (id<NSCopying>)(CHHapticPatternKeyTime):@0.0,
|
||||
// (id<NSCopying>)(CHHapticPatternKeyEventDuration):[NSNumber numberWithDouble:duration],
|
||||
// (id<NSCopying>)(CHHapticPatternKeyEventParameters):@[
|
||||
// @{
|
||||
// CHHapticPatternKeyParameterID: CHHapticEventParameterIDHapticIntensity,
|
||||
// CHHapticPatternKeyParameterValue: @1.0,
|
||||
// (id<NSCopying>)(CHHapticPatternKeyParameterID): CHHapticEventParameterIDHapticIntensity,
|
||||
// (id<NSCopying>)(CHHapticPatternKeyParameterValue): @1.0,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
@ -84,6 +92,7 @@ package mobile
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
import "C"
|
||||
|
||||
@ -92,10 +101,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
C.initializeVibrate()
|
||||
}
|
||||
|
||||
var vibrationM sync.Mutex
|
||||
|
||||
func (u *UserInterface) Vibrate(duration time.Duration) {
|
||||
|
Loading…
Reference in New Issue
Block a user