Add GLFW_COCOA_RETINA_FRAMEBUFFER

Look, a can of worms!  I wonder what's inside.

This adds the first platform specific window hint, transforming
a compile-time option to a run-time per-window one.
This commit is contained in:
Camilla Löwy
2016-12-07 00:41:54 +01:00
parent 766a9dc9fd
commit 58ceab5f1e
10 changed files with 32 additions and 22 deletions
-3
View File
@@ -381,9 +381,6 @@ const char* _glfwPlatformGetVersionString(void)
#if defined(_GLFW_USE_MENUBAR)
" menubar"
#endif
#if defined(_GLFW_USE_RETINA)
" retina"
#endif
#if defined(_GLFW_BUILD_DLL)
" dynamic"
#endif
+2 -3
View File
@@ -1038,9 +1038,8 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
#if defined(_GLFW_USE_RETINA)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
#endif /*_GLFW_USE_RETINA*/
if (wndconfig->ns.retina)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
[window->ns.object setContentView:window->ns.view];
[window->ns.object makeFirstResponder:window->ns.view];
-2
View File
@@ -62,6 +62,4 @@
#cmakedefine _GLFW_USE_CHDIR
// Define this to 1 if glfwCreateWindow should populate the menu bar
#cmakedefine _GLFW_USE_MENUBAR
// Define this to 1 if windows should use full resolution on Retina displays
#cmakedefine _GLFW_USE_RETINA
+3
View File
@@ -264,6 +264,9 @@ struct _GLFWwndconfig
GLFWbool autoIconify;
GLFWbool floating;
GLFWbool maximized;
struct {
GLFWbool retina;
} ns;
};
/*! @brief Context configuration.
+6
View File
@@ -266,6 +266,9 @@ void glfwDefaultWindowHints(void)
// The default is to select the highest available refresh rate
_glfw.hints.refreshRate = GLFW_DONT_CARE;
// The default is to use full Retina resolution framebuffers
_glfw.hints.window.ns.retina = GLFW_TRUE;
}
GLFWAPI void glfwWindowHint(int hint, int value)
@@ -340,6 +343,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
case GLFW_VISIBLE:
_glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
break;
case GLFW_COCOA_RETINA_FRAMEBUFFER:
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
break;
case GLFW_CLIENT_API:
_glfw.hints.context.client = value;
break;