* 'master' of https://bitbucket.org/omigamedev/new_engine:
  add text input popup
This commit is contained in:
2019-09-12 15:18:22 +02:00
12 changed files with 186 additions and 12 deletions

View File

@@ -180,18 +180,28 @@ std::recursive_mutex lock_mutex;
(__bridge CFStringRef)ext, NULL);
[UTIs addObject:typeForExt];
}
GameFilePicker *picker = [[GameFilePicker alloc] initWithDocumentTypes:UTIs inMode:UIDocumentPickerModeImport];
picker.delegate = self;
picker->callback = callback;
[self presentViewController:picker animated:YES completion:NULL];
}
- (void)pick_file_save:(std::string)path
{
NSURL* url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:path.c_str()]];
GameFilePicker *picker = [[GameFilePicker alloc] initWithURL:url inMode:UIDocumentPickerModeMoveToService];
picker.delegate = self;
[self presentViewController:picker animated:YES completion:NULL];
}
-(void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url
{
NSString *chosenImage = [url path];
GameFilePicker* p = static_cast<GameFilePicker*>(controller);
std::string path = [chosenImage cStringUsingEncoding:NSUTF8StringEncoding];
p->callback(path);
if (p->callback)
{
std::string path = [chosenImage cStringUsingEncoding:NSUTF8StringEncoding];
p->callback(path);
}
[controller dismissViewControllerAnimated:YES completion:NULL];
}
-(void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller