#import #include #include #include #include @interface BasicMTKView : MTKView { @private id device; id commandQueue; id library; } - (CAMetalLayer *)metalLayer; - (id)metalDevice; - (id)metalQueue; - (void)keyDown:(NSEvent *)theEvent; - (void)keyUp:(NSEvent *)theEvent; - (void)mouseDown:(NSEvent *)theEvent; - (void)mouseUp:(NSEvent *)theEvent; - (void)mouseMoved:(NSEvent *)theEvent; - (void)mouseDragged:(NSEvent *)theEvent; - (void)rightMouseDown:(NSEvent *)theEvent; - (void)rightMouseUp:(NSEvent *)theEvent; - (void)rightMouseDragged:(NSEvent *)theEvent; - (void)scrollWheel:(NSEvent *)theEvent; - (NSDragOperation)draggingEntered:(id)sender; - (BOOL)performDragOperation:(id)sender; - (BOOL)acceptsFirstResponder; - (BOOL)becomeFirstResponder; - (BOOL)resignFirstResponder; - (id)initWithFrame:(NSRect)frameRect; - (void)resize:(NSSize)size; @end #ifdef WITH_GAMEPAD struct HIDGamepad { int padIndex; IOHIDDeviceRef hidDeviceRef; IOHIDQueueRef hidQueueRef; int hidDeviceVendorID; int hidDeviceProductID; char hidDeviceVendor[64]; char hidDeviceProduct[64]; IOHIDElementCookie axis[6]; IOHIDElementCookie buttons[15]; }; void HIDGamepad_init(struct HIDGamepad *gamepad); void HIDGamepad_destroy(struct HIDGamepad *gamepad); void HIDGamepad_bind(struct HIDGamepad *gamepad, IOHIDDeviceRef deviceRef, int padIndex); void HIDGamepad_unbind(struct HIDGamepad *gamepad); static const int IRON_MAX_HID_DEVICES = 8; // Slots to hold details on connected devices struct HIDManagerDeviceRecord { bool connected; // = false; IOHIDDeviceRef device; // = NULL; struct HIDGamepad pad; }; struct HIDManager { IOHIDManagerRef managerRef; struct HIDManagerDeviceRecord devices[IRON_MAX_HID_DEVICES]; }; void HIDManager_init(struct HIDManager *manager); void HIDManager_destroy(struct HIDManager *manager); #endif