Skip to content

Commit

Permalink
prepare to add touch callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
blueloveTH committed Mar 23, 2024
1 parent cae863a commit 2900607
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/platforms/rcore_ios.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ extern void ios_destroy();
/* GameViewController */
@interface GameViewController : UIViewController
- (void)update;
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesEstimatedPropertiesUpdated:(NSSet<UITouch *> *)touches;
@end

/* AppDelegate */
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
}


Expand Down Expand Up @@ -645,6 +650,7 @@ void ClosePlatform(void)
[super viewDidLoad];
// self.modalPresentationCapturesStatusBarAppearance = true;
platform.viewController = self;
self.view.multipleTouchEnabled = true;
}

- (void)update
Expand Down

0 comments on commit 2900607

Please sign in to comment.