Metal RayTracing のサンプルでキーボードを使う

下記のコードを Main.storyboard の Game View Controller Scene -> Game View Controller -> View の中の Custom Class MTKView を書き換えて、GameView を設定する

#import <Cocoa/Cocoa.h>
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
#import "Renderer.h"

@interface GameView : MTKView
@end
#import "GameView.h"
@implementation GameView
- (void)keyDown:(NSEvent *)theEvent
{
    switch (theEvent.keyCode)
    {        
        case 0x12: [self._renderer Press1]; break;
        case 0x13: [self._renderer Press2]; break;
        case 0x14: [self._renderer Press3]; break;
        
        case 0x00: [self._renderer PressA]; break;
        case 0x01: [self._renderer PressS]; break;
        case 0x02: [self._renderer PressD]; break;
        case 0x0D: [self._renderer PressW]; break;
        
        case 0x0E: [self._renderer PressE]; break;
        case 0x0C: [self._renderer PressQ]; break;
        
        case 0x7C: [self._renderer PressRight]; break;
        case 0x7B: [self._renderer PressLeft]; break;
        
        default:
            NSLog(@"keyDown:'%@' keyCode: 0x%02X", theEvent.characters, theEvent.keyCode);
            break;
    }
}
- (BOOL)acceptsFirstResponder
{
    return YES;
}
@end