mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 07:41:05 +08:00
Fixed NSApplication not retaining its delegate
This commit is contained in:
parent
0d47056132
commit
324d4a18e7
@ -50,4 +50,10 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return a singleton instance of this class
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
+(id)instance;
|
||||
|
||||
@end
|
||||
|
@ -49,6 +49,14 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
+(id)instance
|
||||
{
|
||||
static SFApplicationDelegate* singleton = nil;
|
||||
if (singleton == nil)
|
||||
singleton = [[SFApplicationDelegate alloc] init];
|
||||
return singleton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
@ -139,7 +139,7 @@ void WindowImplCocoa::setUpProcess(void)
|
||||
|
||||
// Register an application delegate if there is none
|
||||
if (![[SFApplication sharedApplication] delegate])
|
||||
[NSApp setDelegate:[[SFApplicationDelegate alloc] init]];
|
||||
[NSApp setDelegate:[SFApplicationDelegate instance]];
|
||||
|
||||
// Create menus for the application (before finishing launching!)
|
||||
[SFApplication setUpMenuBar];
|
||||
|
Loading…
Reference in New Issue
Block a user