mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
fixed tabs
This commit is contained in:
parent
450502f672
commit
2e2bd93a1c
|
@ -24,9 +24,10 @@
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)rect
|
- (void)drawRect:(NSRect)rect
|
||||||
{
|
{
|
||||||
(void)rect;
|
(void)rect;
|
||||||
CGContextRef context = [[NSGraphicsContext currentContext] CGContext];
|
CGContextRef context = [[NSGraphicsContext currentContext] CGContext];
|
||||||
//CGContextRef context = [[NSGraphicsContext currentContext]];
|
|
||||||
|
printf("drawRect\n");
|
||||||
|
|
||||||
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
|
||||||
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, draw_buffer, width * height * 4, NULL);
|
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, draw_buffer, width * height * 4, NULL);
|
||||||
|
@ -44,34 +45,52 @@
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*
|
|
||||||
- (BOOL)wantsUpdateLayer
|
- (BOOL)wantsUpdateLayer
|
||||||
{
|
{
|
||||||
return TRUE;
|
printf("wantsUpdateLayer\n");
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*
|
|
||||||
-(void)updateLayer
|
-(void)updateLayer
|
||||||
{
|
{
|
||||||
// Force the graphics context to clear to black so we don't get a flash of
|
printf("update layer\n");
|
||||||
// white until the app is ready to draw. In practice on modern macOS, this
|
// Force the graphics context to clear to black so we don't get a flash of
|
||||||
// only gets called for window creation and other extraordinary events.
|
// white until the app is ready to draw. In practice on modern macOS, this
|
||||||
self.layer.backgroundColor = NSColor.blackColor.CGColor;
|
// only gets called for window creation and other extraordinary events.
|
||||||
ScheduleContextUpdates((SDL_WindowData *) _sdlWindow->driverdata);
|
self.layer.backgroundColor = NSColor.blackColor.CGColor;
|
||||||
SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
//NSGraphicsContext* context = [NSGraphicsContext currentContext];
|
||||||
|
//[context scheduleUpdate];
|
||||||
|
|
||||||
[context scheduleUpdate];
|
//(void)rect;
|
||||||
|
CGContextRef context = [[NSGraphicsContext currentContext] CGContext];
|
||||||
|
|
||||||
|
//printf("drawRect\n");
|
||||||
|
|
||||||
|
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
|
||||||
|
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, draw_buffer, width * height * 4, NULL);
|
||||||
|
|
||||||
|
CGImageRef img = CGImageCreate(width, height, 8, 32, width * 4, space, kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little,
|
||||||
|
provider, NULL, false, kCGRenderingIntentDefault);
|
||||||
|
|
||||||
|
CGColorSpaceRelease(space);
|
||||||
|
CGDataProviderRelease(provider);
|
||||||
|
|
||||||
|
CGContextDrawImage(context, CGRectMake(0, 0, width * scale, height * scale), img);
|
||||||
|
|
||||||
|
CGImageRelease(img);
|
||||||
|
|
||||||
|
//ScheduleContextUpdates((SDL_WindowData *) _sdlWindow->driverdata);
|
||||||
|
//SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
||||||
|
//[context scheduleUpdate];
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent*)event
|
- (void)mouseDown:(NSEvent*)event
|
||||||
{
|
{
|
||||||
(void)event;
|
(void)event;
|
||||||
OSXWindow* window = (OSXWindow*)[self window];
|
OSXWindow* window = (OSXWindow*)[self window];
|
||||||
window->shared_data->mouse_state[0] = 1;
|
window->shared_data->mouse_state[0] = 1;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +99,7 @@
|
||||||
|
|
||||||
- (void)mouseUp:(NSEvent*)event
|
- (void)mouseUp:(NSEvent*)event
|
||||||
{
|
{
|
||||||
(void)event;
|
(void)event;
|
||||||
OSXWindow* window = (OSXWindow*)[self window];
|
OSXWindow* window = (OSXWindow*)[self window];
|
||||||
window->shared_data->mouse_state[0] = 0;
|
window->shared_data->mouse_state[0] = 0;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +108,7 @@
|
||||||
|
|
||||||
- (void)rightMouseDown:(NSEvent*)event
|
- (void)rightMouseDown:(NSEvent*)event
|
||||||
{
|
{
|
||||||
(void)event;
|
(void)event;
|
||||||
OSXWindow* window = (OSXWindow*)[self window];
|
OSXWindow* window = (OSXWindow*)[self window];
|
||||||
window->shared_data->mouse_state[2] = 1;
|
window->shared_data->mouse_state[2] = 1;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +117,7 @@
|
||||||
|
|
||||||
- (void)rightMouseUp:(NSEvent*)event
|
- (void)rightMouseUp:(NSEvent*)event
|
||||||
{
|
{
|
||||||
(void)event;
|
(void)event;
|
||||||
OSXWindow* window = (OSXWindow*)[self window];
|
OSXWindow* window = (OSXWindow*)[self window];
|
||||||
window->shared_data->mouse_state[2] = 0;
|
window->shared_data->mouse_state[2] = 0;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +176,7 @@
|
||||||
|
|
||||||
- (void)windowResized:(NSNotification *)notification
|
- (void)windowResized:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
(void)notification;
|
(void)notification;
|
||||||
NSSize size = [self bounds].size;
|
NSSize size = [self bounds].size;
|
||||||
OSXWindow* window = (OSXWindow*)[self window];
|
OSXWindow* window = (OSXWindow*)[self window];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue