From 29006070f48d889b674bcba4e0d807376c4f654c Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 24 Mar 2024 01:59:56 +0800 Subject: [PATCH] prepare to add touch callbacks --- src/platforms/rcore_ios.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/platforms/rcore_ios.c b/src/platforms/rcore_ios.c index d7bcf528e2d8..d917b9e6762f 100644 --- a/src/platforms/rcore_ios.c +++ b/src/platforms/rcore_ios.c @@ -60,6 +60,11 @@ extern void ios_destroy(); /* GameViewController */ @interface GameViewController : UIViewController - (void)update; +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesEstimatedPropertiesUpdated:(NSSet *)touches; @end /* AppDelegate */ @@ -71,7 +76,6 @@ extern void ios_destroy(); // Types and Structures Definition //---------------------------------------------------------------------------------- typedef struct { - // TODO: Define the platform specific variables required GameViewController *viewController; // Root view controller // Display data @@ -92,7 +96,6 @@ static PlatformData platform = { 0 }; // Platform specific data // Module Internal Functions Declaration //---------------------------------------------------------------------------------- int InitPlatform(void); // Initialize platform (graphics, inputs and more) -bool InitGraphicsDevice(void); // Initialize graphics device //---------------------------------------------------------------------------------- // Module Functions Declaration @@ -441,7 +444,9 @@ void PollInputEvents(void) } // TODO: Poll input events for iOS - + + // Register touch points count + // https://developer.apple.com/documentation/uikit/touches_presses_and_gestures } @@ -645,6 +650,7 @@ void ClosePlatform(void) [super viewDidLoad]; // self.modalPresentationCapturesStatusBarAppearance = true; platform.viewController = self; + self.view.multipleTouchEnabled = true; } - (void)update