Created
December 5, 2013 16:20
-
-
Save ofZach/7808368 to your computer and use it in GitHub Desktop.
modifying glfw window in OF (0.8)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in main.cpp | |
ofAppGLFWWindow w; | |
ofSetupOpenGL(&w, 1024,432,OF_WINDOW); // <-------- setup the GL context | |
testApp * app = new testApp(); | |
app->WINDOW = &w; | |
ofRunApp(app); | |
// in testApp.h: | |
ofAppGLFWWindow * WINDOW; | |
// in testApp.cpp: | |
if (key == 'a'){ | |
border = !border; | |
if (!border){ | |
NSWindow * window = (NSWindow * )WINDOW->getCocoaWindow(); | |
[window setStyleMask:NSBorderlessWindowMask]; | |
[window setLevel:NSFloatingWindowLevel]; | |
window.level = NSMainMenuWindowLevel + 1; | |
ofSetWindowPosition(0,0); | |
} else { | |
NSWindow * window = (NSWindow * )WINDOW->getCocoaWindow(); | |
window.level = NSMainMenuWindowLevel - 1; | |
ofSetWindowPosition(0,200); | |
[window setStyleMask: NSResizableWindowMask| NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask]; | |
[window makeKeyAndOrderFront:nil]; | |
} | |
return; | |
} | |
FYI - if you wan't your window to be a normal window when you make it have a border again, you have to change your window level to NSNormalWindowLevel - as below - otherwise when you take it out of fullscreen, it will still be stuck on top
NSWindow * window = (NSWindow * )WINDOW->getCocoaWindow();
window.level = NSNormalWindowLevel;
ofSetWindowPosition(0,800);
[window setStyleMask: NSResizableWindowMask| NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask];
[window makeKeyAndOrderFront:nil];
ofSetWindowPosition(0,800);
ofSetWindowShape(3840,1080);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
additional comments on usage here:
http://forum.openframeworks.cc/t/fullscreen-dual-screen/693/28