Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed issue with touch input on retina displays
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 30, 2012
1 parent 2fd5441 commit 4f6929d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/video/uikit/SDL_uikitview.m
Expand Up @@ -85,13 +85,14 @@ - (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize
SDL_Window *window = self->viewcontroller.window;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata;
point.x *= displaymodedata->scale;
point.y *= displaymodedata->scale;

if (normalize) {
CGRect bounds = [self bounds];
point.x /= bounds.size.width;
point.y /= bounds.size.height;
} else {
point.x *= displaymodedata->scale;
point.y *= displaymodedata->scale;
}
return point;
}
Expand Down

0 comments on commit 4f6929d

Please sign in to comment.