38@implementation GameController (FullScreen)
42 NSArray *modes = [gameView getScreenSizeArray];
44 unsigned int modeIndex, modeCount;
45 unsigned int modeWidth, modeHeight;
48 modeCount = [modes count];
49 for (modeIndex = 0; modeIndex < modeCount; modeIndex++)
51 mode = [modes objectAtIndex: modeIndex];
52 modeWidth = [[mode
objectForKey: kOODisplayWidth] intValue];
53 modeHeight = [[mode
objectForKey: kOODisplayHeight] intValue];
60 [displayModes addObject: mode];
63 NSSize fsmSize = [gameView currentScreenSize];
64 width = fsmSize.width;
65 height = fsmSize.height;
69- (void) setFullScreenMode:(BOOL)fsm
77 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"fullscreen"];
78 stayInFullScreenMode = NO;
84 return [gameView inFullScreenMode];
88- (BOOL) setDisplayWidth:(
unsigned int) d_width Height:(
unsigned int) d_height Refresh:(
unsigned int) d_refresh
90 NSDictionary *d_mode = [
self findDisplayModeForWidth: d_width Height: d_height Refresh: d_refresh];
96 fullscreenDisplayMode = d_mode;
98 NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
100 [userDefaults setInteger:width forKey:@"display_width"];
101 [userDefaults setInteger:height forKey:@"display_height"];
102 [userDefaults setInteger:refresh forKey:@"display_refresh"];
105 [userDefaults synchronize];
113- (NSDictionary *) findDisplayModeForWidth:(
unsigned int) d_width Height:(
unsigned int) d_height Refresh:(
unsigned int) d_refresh
117 unsigned int modeWidth, modeHeight, modeRefresh;
119 modeCount = [displayModes count];
121 for (i = 0; i < modeCount; i++)
123 mode = [displayModes objectAtIndex: i];
124 modeWidth = [[mode
objectForKey:kOODisplayWidth] intValue];
125 modeHeight = [[mode
objectForKey:kOODisplayHeight] intValue];
126 modeRefresh = [[mode
objectForKey:kOODisplayRefreshRate] intValue];
127 if ((modeWidth == d_width)&&(modeHeight == d_height)&&(modeRefresh == d_refresh))
138 return [NSArray arrayWithArray:displayModes];
146 mode = [
self findDisplayModeForWidth: width Height: height Refresh: refresh];
150 return [displayModes indexOfObject:mode];
156- (void) pauseFullScreenModeToPerform:(
SEL) selector onTarget:(
id) target
158 pauseSelector = selector;
159 pauseTarget = target;
160 stayInFullScreenMode = NO;
#define DISPLAY_MAX_WIDTH
#define DISPLAY_MAX_HEIGHT
#define DISPLAY_MIN_HEIGHT
#define DISPLAY_MIN_WIDTH
void exitFullScreenMode()
NSUInteger indexOfCurrentDisplayMode()