28#import "MyOpenGLView.h"
41@interface GameController (OOPrimaryWindowDelegate) <OOPrimaryWindowDelegate>
47@implementation GameController (FullScreen)
49- (void) setUpDisplayModes
54#if OO_MAC_SUPPORT_SYSTEM_STANDARD_FULL_SCREEN
55 if ([OOMacSystemStandardFullScreenController shouldUseSystemStandardFullScreenController])
57 fullScreenController = [[OOMacSystemStandardFullScreenController alloc] initWithGameView:gameView];
61 if (fullScreenController ==
nil)
63 fullScreenController = [[OOMacSnowLeopardFullScreenController alloc] initWithGameView:gameView];
69 NSUInteger width = [currentMode oo_unsignedIntegerForKey:kOODisplayWidth];
70 NSUInteger height = [currentMode oo_unsignedIntegerForKey:kOODisplayHeight];
71 NSUInteger refresh = [currentMode oo_unsignedIntegerForKey:kOODisplayRefreshRate];
73 NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
74 width = [userDefaults oo_unsignedIntegerForKey:@"display_width" defaultValue:width];
75 height = [userDefaults oo_unsignedIntegerForKey:@"display_height" defaultValue:height];
76 refresh = [userDefaults oo_unsignedIntegerForKey:@"display_refresh" defaultValue:refresh];
80 _fullScreenController = fullScreenController;
86- (IBAction) toggleFullScreenAction:(
id)sender
88 [
self setFullScreenMode:![
self inFullScreenMode]];
92- (void) toggleFullScreenCalledForWindow:(
OOPrimaryWindow *)window withSender:(
id)sender
94 [
self toggleFullScreenAction:sender];
100- (BOOL) inFullScreenMode
102 return [_fullScreenController inFullScreenMode];
106- (void) setFullScreenMode:(BOOL)value
108 if (value == [
self inFullScreenMode])
return;
110 [[NSUserDefaults standardUserDefaults] setBool:value forKey:@"fullscreen"];
114 [_fullScreenController setFullScreenMode:YES];
118 [_fullScreenController setFullScreenMode:NO];
123- (void) exitFullScreenMode
125 [
self setFullScreenMode:NO];
129- (BOOL) setDisplayWidth:(
unsigned int)width Height:(
unsigned int)height Refresh:(
unsigned int)refreshRate
131 if ([_fullScreenController setDisplayWidth:width height:height refreshRate:refreshRate])
133 NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
135 [userDefaults setInteger:width forKey:@"display_width"];
136 [userDefaults setInteger:height forKey:@"display_height"];
137 [userDefaults setInteger:refreshRate forKey:@"display_refresh"];
139 [userDefaults synchronize];
150- (NSDictionary *) findDisplayModeForWidth:(
unsigned int)d_width Height:(
unsigned int)d_height Refresh:(
unsigned int)d_refresh
152 return [_fullScreenController findDisplayModeForWidth:d_width height:d_height refreshRate:d_refresh];
156- (NSArray *) displayModes
158 return [_fullScreenController displayModes];