Fix F1 on/off toggle for ImGui overlay (all platforms), clean up keycode handling (mostly macOS/iOS)

This commit is contained in:
Stephen Saunders 2022-08-01 16:11:57 -04:00
parent 5c2aaaf693
commit 1b3fe76cdb
7 changed files with 106 additions and 70 deletions

View file

@ -97,7 +97,16 @@ MVKExample* _mvkExample;
-(void) keyDown:(NSEvent*) theEvent {
NSString *text = [theEvent charactersIgnoringModifiers];
unichar keychar = (text.length > 0) ? [text.lowercaseString characterAtIndex: 0] : 0;
_mvkExample->keyDown(keychar);
switch (keychar)
{
case KEY_DELETE: // support keyboards with no escape key
case KEY_ESCAPE:
[NSApp terminate:nil];
break;
default:
_mvkExample->keyDown(keychar);
break;
}
}
-(void) keyUp:(NSEvent*) theEvent {