mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-13 16:44:50 +02:00
#15 OSX Alt + Enter to toggle fullscreen mode
This commit is contained in:
@@ -279,6 +279,8 @@ void joyFree() {
|
|||||||
IOHIDManagerClose(hidManager, kIOHIDOptionsTypeNone);
|
IOHIDManagerClose(hidManager, kIOHIDOptionsTypeNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSWindow *window;
|
||||||
|
|
||||||
@interface OpenLaraGLView : NSOpenGLView
|
@interface OpenLaraGLView : NSOpenGLView
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -349,6 +351,9 @@ void joyFree() {
|
|||||||
- (void)keyUp:(NSEvent *)theEvent {
|
- (void)keyUp:(NSEvent *)theEvent {
|
||||||
unsigned short keyCode = theEvent.keyCode;
|
unsigned short keyCode = theEvent.keyCode;
|
||||||
Input::setDown(keyToInputKey(keyCode), false);
|
Input::setDown(keyToInputKey(keyCode), false);
|
||||||
|
if (keyCode == 36 && Input::down[ikAlt]) { // Alt + Enter
|
||||||
|
[window toggleFullScreen:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)flagsChanged:(NSEvent *)theEvent {
|
- (void)flagsChanged:(NSEvent *)theEvent {
|
||||||
@@ -410,7 +415,7 @@ int main() {
|
|||||||
|
|
||||||
// init window
|
// init window
|
||||||
NSRect rect = NSMakeRect(0, 0, 1280, 720);
|
NSRect rect = NSMakeRect(0, 0, 1280, 720);
|
||||||
NSWindow *window = [[NSWindow alloc] initWithContentRect:rect styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask backing:NSBackingStoreBuffered defer:YES];
|
window = [[NSWindow alloc] initWithContentRect:rect styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask backing:NSBackingStoreBuffered defer:YES];
|
||||||
window.title = @"OpenLara";
|
window.title = @"OpenLara";
|
||||||
window.acceptsMouseMovedEvents = YES;
|
window.acceptsMouseMovedEvents = YES;
|
||||||
window.delegate = [[OpenLaraWindowDelegate alloc] init];
|
window.delegate = [[OpenLaraWindowDelegate alloc] init];
|
||||||
|
Reference in New Issue
Block a user