|
@@ -114,8 +114,29 @@ Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
|
|
return SDL_EGL_MakeCurrent(_this, window ? ((__bridge SDL_WindowData *) window->driverdata).egl_surface : EGL_NO_SURFACE, context);
|
|
|
}}
|
|
|
|
|
|
+void
|
|
|
+Cocoa_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
|
|
+{ @autoreleasepool
|
|
|
+{
|
|
|
+ SDL_WindowData *windata = (__bridge SDL_WindowData *)window->driverdata;
|
|
|
+ NSView *contentView = windata.nswindow.contentView;
|
|
|
+ CALayer *layer = [contentView layer];
|
|
|
+
|
|
|
+ int width = layer.bounds.size.width * layer.contentsScale;
|
|
|
+ int height = layer.bounds.size.height * layer.contentsScale;
|
|
|
+
|
|
|
+ if (w) {
|
|
|
+ *w = width;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (h) {
|
|
|
+ *h = height;
|
|
|
+ }
|
|
|
+}}
|
|
|
+
|
|
|
int
|
|
|
Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window)
|
|
|
+{ @autoreleasepool
|
|
|
{
|
|
|
NSView* v;
|
|
|
/* The current context is lost in here; save it and reset it. */
|
|
@@ -145,7 +166,7 @@ Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window)
|
|
|
}
|
|
|
|
|
|
return Cocoa_GLES_MakeCurrent(_this, current_win, current_ctx);
|
|
|
-}
|
|
|
+}}
|
|
|
|
|
|
SDL_EGLSurface
|
|
|
Cocoa_GLES_GetEGLSurface(_THIS, SDL_Window * window)
|