mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-03 10:27:40 +00:00
Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
This commit is contained in:
parent
70c781c803
commit
00452e47fa
32 changed files with 122 additions and 142 deletions
|
@ -385,28 +385,6 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
|||
return 0;
|
||||
}}
|
||||
|
||||
void
|
||||
Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
||||
{ @autoreleasepool
|
||||
{
|
||||
SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata;
|
||||
NSView *contentView = windata.sdlContentView;
|
||||
NSRect viewport = [contentView bounds];
|
||||
|
||||
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
||||
/* This gives us the correct viewport for a Retina-enabled view. */
|
||||
viewport = [contentView convertRectToBacking:viewport];
|
||||
}
|
||||
|
||||
if (w) {
|
||||
*w = viewport.size.width;
|
||||
}
|
||||
|
||||
if (h) {
|
||||
*h = viewport.size.height;
|
||||
}
|
||||
}}
|
||||
|
||||
int
|
||||
Cocoa_GL_SetSwapInterval(_THIS, int interval)
|
||||
{ @autoreleasepool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue