[Mac] Full-screen mode is once again remembered across runs. (In 64-bit, it's remembered even though it doesn't do anything except change the name of a menu item.)
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5188 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
3d8084f015
commit
76e3ab0dd6
@ -437,7 +437,6 @@ static NSComparisonResult CompareDisplayModes(id arg1, id arg2, void *context);
|
||||
/* Tell the scene the dimensions of the area it's going to render to,
|
||||
so it can set up an appropriate viewport and viewing transformation.
|
||||
*/
|
||||
NSLog(@"Current OpenGL context: %@", [NSOpenGLContext currentContext]);
|
||||
[gameView initialiseGLWithSize:(NSSize){ _width, _height }];
|
||||
[UNIVERSE forceLightSwitch]; // Avoid lighting glitch when switching to full screen. FIXME: can we move this to MyOpenGLView so we don't need to know about Universe here?
|
||||
|
||||
|
@ -481,6 +481,7 @@ static NSTimeInterval time_last_frame;
|
||||
exceptionContext = @"command key controls";
|
||||
if ([gameView isCommandFDown])
|
||||
{
|
||||
[gameView clearCommandF];
|
||||
[[gameView gameController] exitFullScreenMode];
|
||||
if (mouse_control_on)
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ MA 02110-1301, USA.
|
||||
|
||||
|
||||
#import "GameController.h"
|
||||
#import "MyOpenGLView.h"
|
||||
|
||||
#if OOLITE_MAC_OS_X // TEMP, should be used for SDL too
|
||||
|
||||
@ -61,16 +62,43 @@ MA 02110-1301, USA.
|
||||
|
||||
- (IBAction) toggleFullScreenAction:(id)sender
|
||||
{
|
||||
if (![_fullScreenController inFullScreenMode])
|
||||
[self setFullScreenMode:![self inFullScreenMode]];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
- (BOOL) inFullScreenMode
|
||||
{
|
||||
return [_fullScreenController inFullScreenMode];
|
||||
}
|
||||
|
||||
|
||||
- (void) setFullScreenMode:(BOOL)value
|
||||
{
|
||||
#if OOLITE_MAC_LEGACY_FULLSCREEN
|
||||
// HACK: the commandF flag can linger when switching between event loops.
|
||||
[gameView clearCommandF];
|
||||
#endif
|
||||
|
||||
if (value == [self inFullScreenMode]) return;
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setBool:value forKey:@"fullscreen"];
|
||||
|
||||
if (value)
|
||||
{
|
||||
[_fullScreenController setFullScreenMode:YES];
|
||||
|
||||
#if OOLITE_MAC_LEGACY_FULLSCREEN
|
||||
// Mac legacy controller needs to take over the world. By which I mean the event loop.
|
||||
if (_fullScreenController.fullScreenMode)
|
||||
if ([_fullScreenController inFullScreenMode])
|
||||
{
|
||||
[(OOMacLegacyFullScreenController *)_fullScreenController runFullScreenModalEventLoop];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"fullscreen"];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -79,8 +107,6 @@ MA 02110-1301, USA.
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
- (void) changeFullScreenResolution
|
||||
{
|
||||
@ -90,13 +116,7 @@ MA 02110-1301, USA.
|
||||
|
||||
- (void) exitFullScreenMode
|
||||
{
|
||||
[_fullScreenController setFullScreenMode:NO];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) inFullScreenMode
|
||||
{
|
||||
return [_fullScreenController inFullScreenMode];
|
||||
[self setFullScreenMode:NO];
|
||||
}
|
||||
|
||||
|
||||
@ -114,13 +134,13 @@ MA 02110-1301, USA.
|
||||
|
||||
- (NSArray *) displayModes
|
||||
{
|
||||
return _fullScreenController.displayModes;
|
||||
return [_fullScreenController displayModes];
|
||||
}
|
||||
|
||||
|
||||
- (OOUInteger) indexOfCurrentDisplayMode
|
||||
{
|
||||
return _fullScreenController.indexOfCurrentDisplayMode;
|
||||
return [_fullScreenController indexOfCurrentDisplayMode];
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,6 +66,10 @@ MA 02110-1301, USA.
|
||||
@class MyOpenGLView, OOFullScreenController;
|
||||
|
||||
|
||||
// TEMP: whether to use separate OOFullScreenController object, will hopefully be used for all builds soon.
|
||||
#define OO_USE_FULLSCREEN_CONTROLLER OOLITE_MAC_OS_X
|
||||
|
||||
|
||||
#if OOLITE_MAC_OS_X
|
||||
#define kOODisplayWidth ((NSString *)kCGDisplayWidth)
|
||||
#define kOODisplayHeight ((NSString *)kCGDisplayHeight)
|
||||
@ -109,8 +113,10 @@ MA 02110-1301, USA.
|
||||
|
||||
BOOL gameIsPaused;
|
||||
|
||||
// Fullscreen mode stuff
|
||||
#if OOLITE_SDL
|
||||
// Fullscreen mode stuff.
|
||||
#if OO_USE_FULLSCREEN_CONTROLLER
|
||||
OOFullScreenController *_fullScreenController;
|
||||
#elif OOLITE_SDL
|
||||
NSRect fsGeometry;
|
||||
MyOpenGLView *switchView;
|
||||
|
||||
@ -123,8 +129,6 @@ MA 02110-1301, USA.
|
||||
NSDictionary *fullscreenDisplayMode;
|
||||
|
||||
BOOL stayInFullScreenMode;
|
||||
#elif OOLITE_MAC_OS_X
|
||||
OOFullScreenController *_fullScreenController;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -183,15 +187,21 @@ MA 02110-1301, USA.
|
||||
|
||||
@interface GameController (FullScreen)
|
||||
|
||||
#if OOLITE_HAVE_APPKIT
|
||||
#if OO_USE_FULLSCREEN_CONTROLLER
|
||||
#if OOLITE_MAC_OS_X
|
||||
- (IBAction) toggleFullScreenAction:(id)sender;
|
||||
#if OOLITE_MAC_LEGACY_FULLSCREEN
|
||||
#endif
|
||||
|
||||
- (void) changeFullScreenResolution;
|
||||
|
||||
/* NOTE: on 32-bit Mac OS X (OOLITE_MAC_LEGACY_FULLSCREEN),
|
||||
setFullScreenMode:YES takes over the event loop and doesn't return until
|
||||
exiting full screen mode.
|
||||
*/
|
||||
- (void) setFullScreenMode:(BOOL)value;
|
||||
#endif
|
||||
#elif OOLITE_SDL
|
||||
- (void) setFullScreenMode:(BOOL)fsm;
|
||||
#endif
|
||||
- (void) exitFullScreenMode;
|
||||
|
||||
- (void) exitFullScreenMode; // FIXME: should be setFullScreenMode:NO
|
||||
- (BOOL) inFullScreenMode;
|
||||
|
||||
- (BOOL) setDisplayWidth:(unsigned int) d_width Height:(unsigned int)d_height Refresh:(unsigned int) d_refresh;
|
||||
|
@ -208,10 +208,13 @@ static GameController *sSharedController = nil;
|
||||
|
||||
OOLog(@"loading.complete", @"========== Loading complete. ==========");
|
||||
|
||||
#if OO_USE_FULLSCREEN_CONTROLLER
|
||||
[self setFullScreenMode:[[NSUserDefaults standardUserDefaults] boolForKey:@"fullscreen"]];
|
||||
#endif
|
||||
|
||||
// Release anything allocated above that is not required.
|
||||
[pool release];
|
||||
|
||||
// FIXME: initial setup of full screen mode.
|
||||
#if !OOLITE_HAVE_APPKIT
|
||||
[[NSRunLoop currentRunLoop] run];
|
||||
#endif
|
||||
@ -342,7 +345,7 @@ static GameController *sSharedController = nil;
|
||||
}
|
||||
|
||||
|
||||
#if OOLITE_MAC_OS_X && !OOLITE_SDL
|
||||
#if OOLITE_MAC_OS_X
|
||||
|
||||
- (void) recenterVirtualJoystick
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user