mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Command line arguments for ios
This commit is contained in:
parent
97e5fc8a07
commit
17d8c646f2
@ -50,7 +50,13 @@ int client_main(int argc, char * argv[])
|
||||
id __block startGameObserver = [NSNotificationCenter.defaultCenter addObserverForName:@"StartGame" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
||||
[NSNotificationCenter.defaultCenter removeObserver:startGameObserver];
|
||||
startGameObserver = nil;
|
||||
startSDLManually(argc, argv);
|
||||
|
||||
__auto_type args = note.userInfo[@"args"];
|
||||
char * newArgv[args.count];
|
||||
[args enumerateObjectsUsingBlock:^(NSString * obj, NSUInteger idx, BOOL * stop) {
|
||||
newArgv[idx] = obj.UTF8String;
|
||||
}];
|
||||
startSDLManually(args.count, newArgv);
|
||||
}];
|
||||
return qt_main_wrapper(argc, argv);
|
||||
}
|
||||
|
@ -26,5 +26,9 @@ void launchGame(int argc, char * argv[]) {
|
||||
qtNativeWindow.windowScene = nil;
|
||||
#endif
|
||||
}
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"StartGame" object:nil];
|
||||
}
|
||||
|
||||
__auto_type args = [NSMutableArray arrayWithCapacity:argc];
|
||||
for (int i = 0; i < argc; ++i)
|
||||
[arr addObject:@(argv[i])];
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"StartGame" object:nil userInfo:@{@"args": args}];
|
||||
}
|
Loading…
Reference in New Issue
Block a user