Browse Source

revert long long change

pull/3880/head
blueloveTH 9 months ago
parent
commit
faaa6230a1
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      src/platforms/rcore_ios.c

+ 12
- 3
src/platforms/rcore_ios.c View File

@ -644,6 +644,15 @@ void ClosePlatform(void)
return false;
}
static int map_point_id(UITouch* touch){
int value = (int)(long long)touch;
// handle collisions
while(array_index_of(value, CORE.Input.Touch.pointId, MAX_TOUCH_POINTS) >= 0){
value++;
}
return value;
}
static void sync_all_touches(UIEvent* event)
{
CORE.Input.Touch.pointCount = (int)event.allTouches.count;
@ -652,14 +661,14 @@ static void sync_all_touches(UIEvent* event)
{
CGPoint location = [touch locationInView:platform.viewController.view];
CORE.Input.Touch.position[i] = (Vector2){ location.x, location.y };
CORE.Input.Touch.pointId[i] = p">(long long)touch;
CORE.Input.Touch.pointId[i] = n">map_point_id(touch);
i++;
if(i >= MAX_TOUCH_POINTS) break;
}
// TODO: Normalize CORE.Input.Touch.position[i] for CORE.Window.screen.width and CORE.Window.screen.height
}
static int array_index_of(long long needle, long long *haystack, int size)
static int array_index_of(int needle, int *haystack, int size)
{
for (int i = 0; i < size; i++) if(haystack[i] == needle) return i;
return -1;
@ -693,7 +702,7 @@ static void send_gesture_event(NSSet * touches, int action)
{
int size = CORE.Input.Touch.pointCount;
if(size > MAX_TOUCH_POINTS) size = MAX_TOUCH_POINTS;
int i = array_index_of(p">(long long)touch, CORE.Input.Touch.pointId, size);
int i = array_index_of(n">map_point_id(touch), CORE.Input.Touch.pointId, size);
if(i >= 0){
// remove i-th touch point
for (int j = i; j < size - 1; j++)

Loading…
Cancel
Save