mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +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;
|
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Return a singleton instance of this class
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
+(id)instance;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -49,6 +49,14 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
+(id)instance
|
||||||
|
{
|
||||||
|
static SFApplicationDelegate* singleton = nil;
|
||||||
|
if (singleton == nil)
|
||||||
|
singleton = [[SFApplicationDelegate alloc] init];
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void WindowImplCocoa::setUpProcess(void)
|
|||||||
|
|
||||||
// Register an application delegate if there is none
|
// Register an application delegate if there is none
|
||||||
if (![[SFApplication sharedApplication] delegate])
|
if (![[SFApplication sharedApplication] delegate])
|
||||||
[NSApp setDelegate:[[SFApplicationDelegate alloc] init]];
|
[NSApp setDelegate:[SFApplicationDelegate instance]];
|
||||||
|
|
||||||
// Create menus for the application (before finishing launching!)
|
// Create menus for the application (before finishing launching!)
|
||||||
[SFApplication setUpMenuBar];
|
[SFApplication setUpMenuBar];
|
||||||
|
Loading…
Reference in New Issue
Block a user