yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d9443d670
master
1#include "cocoa-util.h" 2 3#import <Cocoa/Cocoa.h> 4#import <QuartzCore/CAMetalLayer.h> 5 6namespace gfx { 7 8void CocoaUtil ::getNSWindowContentSize (void * nswindow ,int * widthOut ,int * heightOut ) 9{ 10NSWindow * window = (NSWindow * )nswindow ; 11const NSRect contentRect = [window .contentView frame ]; 12* widthOut = contentRect .size .width ; 13* heightOut = contentRect .size .height ; 14} 15 16void * CocoaUtil ::createMetalLayer (void * nswindow ) 17{ 18CAMetalLayer * layer = [CAMetalLayer layer ]; 19NSWindow * window = (NSWindow * )nswindow ; 20window .contentView .layer = layer ; 21window .contentView .wantsLayer = YES ; 22return layer ; 23} 24 25void * CocoaUtil ::nextDrawable (void * metalLayer ) 26{ 27CAMetalLayer * layer = (CAMetalLayer * )metalLayer ; 28return [layer nextDrawable ]; 29} 30 31void CocoaUtil ::destroyMetalLayer (void * metalLayer ) 32{ 33CAMetalLayer * layer = (CAMetalLayer * )metalLayer ; 34 [layer release ]; 35} 36 37 38 39}