Skip to content

Instantly share code, notes, and snippets.

@itfrombit
itfrombit / cglayer_blit.m
Last active November 4, 2018 16:43
Bit Blitting with CGLayer
- (void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
static int redOffset = 0;
static int greenOffset = 0;
static int blueOffset = 0;
for (int y = 0; y < _bitmapHeight; y++)
{
@itfrombit
itfrombit / sampletextfield.m
Created March 6, 2019 19:18
Programmatically creating an NSTextField with label
NSTextField* xxxUIControlCreateTextField(NSStackView* parent, const char* label, const char* default_value, u32 tag, float preferred_width, float view_width)
{
NSStackView* stack = [[NSStackView alloc] init];
stack.translatesAutoresizingMaskIntoConstraints = NO;
stack.orientation = NSUserInterfaceLayoutOrientationHorizontal;
stack.spacing = 4;
NSTextField* tf_label = nil;