implement clipboard on iOS

This commit is contained in:
2019-06-25 16:04:16 +02:00
parent 5f72f9901f
commit da6da775a0
7 changed files with 43 additions and 24 deletions

View File

@@ -44,6 +44,18 @@ NSThread* lock_thread;
std::recursive_mutex lock_mutex;
@implementation GameViewController
- (std::string)clipboard_get_string
{
NSString* ns = [[UIPasteboard generalPasteboard] string];
const char* ptr = [ns cStringUsingEncoding:NSUTF8StringEncoding];
return std::string(ptr);
}
- (bool)clipboard_set_string:(const std::string &)s
{
NSString* ns = [NSString stringWithUTF8String:s.c_str()];
[[UIPasteboard generalPasteboard] setString:ns];
return true;
}
- (void)crash
{
AppDelegate* app = (AppDelegate*)[[UIApplication sharedApplication] delegate];