Created
September 8, 2021 17:56
-
-
Save nside/ef5af6fccfcbbf183ecaa0040c6f7917 to your computer and use it in GitHub Desktop.
Override application delegate on iOS with SDL2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You can use this in your main.mm | |
#import "../SDL/include/SDL_uikitappdelegate.h" | |
@interface MyDelegate : SDLUIKitDelegate | |
@end | |
@implementation MyDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
BOOL ret = [super application:application didFinishLaunchingWithOptions:launchOptions]; | |
NSLog(@"Owning the place!"); | |
return ret; | |
} | |
@end | |
// Add a 'category' to the SDL app delegate class | |
@interface SDLUIKitDelegate (extra) | |
{ | |
} | |
@end | |
@implementation SDLUIKitDelegate (extra) | |
+ (NSString *)getAppDelegateClassName { | |
return @"MyDelegate"; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wonder how to avoid XCode complaining on line 25, but otherwise this is very useful, thanks a lot!