psemek/libs/sdl2/platform/apple/metal.m

14 lines
385 B
Objective-C

#ifdef __APPLE__
#include <Foundation/Foundation.h>
#include <QuartzCore/CAMetalLayer.h>
#include <Cocoa/Cocoa.h>
void * metal_layer_from_nswindow(void * nswindow_raw)
{
NSWindow * ns_window = (NSWindow*)nswindow_raw;
[ns_window.contentView setWantsLayer : YES];
id metal_layer = [CAMetalLayer layer];
[ns_window.contentView setLayer : metal_layer];
return metal_layer;
}
#endif