skeleton for cocoa standalone tester

This commit is contained in:
Paul Davis 2024-11-14 14:55:44 -07:00
parent a53b99b307
commit 9f9ef1b180
6 changed files with 143 additions and 0 deletions

42
cocoatea/cocoatea.mm Normal file
View file

@ -0,0 +1,42 @@
/* -*- c++ -*- */
#include <AppKit/AppKit.h>
#include "view.h"
int
main (int argc, char* argv[])
{
NSRect rect = NSMakeRect (100, 100, 500, 500);
NSRect frameRect = NSMakeRect (10, 10, 480, 480);
NSWindow* win = [[NSWindow alloc] initWithContentRect:rect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
CTView* view = [[CTView alloc] initWithFrame:frameRect];
[win setContentView:view];
[[NSApplication sharedApplication] activateIgnoringOtherApps : YES ];
[win makeKeyAndOrderFront:win];
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:view selector:@selector(timedUpdate) userInfo:nil repeats:YES];
[[NSApplication sharedApplication] run];
return 0;
}
/*
1, derive a new View type that will have our drawing methods
2. add time to the run loop to trigger redraws
figure out how to draw
*/