implementing text input on osx

This commit is contained in:
2017-07-16 18:37:00 +01:00
parent 4e765f1450
commit e32329ea98
4 changed files with 26 additions and 1 deletions

View File

@@ -265,6 +265,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
auto keyCode = [theEvent keyCode];
auto chars = [theEvent characters];
App::I.key_down(convert_key(keyCode));
if (const char* cstr = [chars cStringUsingEncoding:NSASCIIStringEncoding])
App::I.key_char(cstr[0]);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)keyUp:(NSEvent *)theEvent