Skip to content

Instantly share code, notes, and snippets.

@kode54
Created June 18, 2017 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kode54/f8f5c7801dd9df6b1ccde784bb573ba6 to your computer and use it in GitHub Desktop.
Save kode54/f8f5c7801dd9df6b1ccde784bb573ba6 to your computer and use it in GitHub Desktop.
Patch against libpez Cocoa implementation for HiDPI support
--- pez.cocoa.m 2010-05-15 14:54:51.000000000 -0700
+++ pez.cocoa.m 2017-06-17 20:58:12.000000000 -0700
@@ -53,6 +53,8 @@
[fmt release];
+ [self setWantsBestResolutionOpenGLSurface:YES];
+
m_frameRect = frame;
m_previousTime = mach_absolute_time();
@@ -80,9 +82,11 @@
[[self window] setOpaque:NO];
[[self window] setAlphaValue:0.99];
}
+
+ NSRect viewBounds = [self convertRectToBacking:[self bounds]];
glewInit();
- const char* szTitle = PezInitialize(PEZ_VIEWPORT_WIDTH, PEZ_VIEWPORT_HEIGHT);
+ const char* szTitle = PezInitialize(viewBounds.size.width, viewBounds.size.height);
m_didInit = YES;
[[self window] setLevel: NSFloatingWindowLevel];
@kode54
Copy link
Author

kode54 commented Jun 18, 2017

The full original library and demos may be found here:

http://prideout.net/blog/p36/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment