Files
armorpaint/base/sources/backends/macos_system.h
T
luboslenco a7df5974ae Gpu cleanup
2025-06-19 19:55:16 +02:00

83 lines
2.1 KiB
C

#import <MetalKit/MTKView.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/hid/IOHIDManager.h>
#include <iron_global.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/hid/IOHIDManager.h>
struct gpu_texture;
@interface BasicOpenGLView : MTKView {
@private
id<MTLDevice> device;
id<MTLCommandQueue> commandQueue;
id<MTLLibrary> library;
}
- (CAMetalLayer *)metalLayer;
- (id<MTLDevice>)metalDevice;
- (id<MTLCommandQueue>)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<NSDraggingInfo>)sender;
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender;
- (void)update; // moved or resized
- (BOOL)acceptsFirstResponder;
- (BOOL)becomeFirstResponder;
- (BOOL)resignFirstResponder;
- (id)initWithFrame:(NSRect)frameRect;
- (void)resize:(NSSize)size;
@end
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 = 12;
// 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);