fixes for mac

This commit is contained in:
2017-03-28 09:08:53 +01:00
parent e8cabebe66
commit 2024b3a280
6 changed files with 65 additions and 7 deletions

View File

@@ -194,18 +194,31 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
}
- (void)mouseDown:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_down(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)mouseUp:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_up(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)mouseMoved:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
-(void)mouseDragged:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
@end
@@ -257,7 +270,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
auto style = NSTitledWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask;
window = [[Window alloc] initWithContentRect:r styleMask:style backing:NSBackingStoreBuffered defer:NO];
[window setTitle:@"hello engine - ui shapes"];
[window setTitle:@"PanoPainter 0.1.2 alpha"];
[window center];
[window makeKeyAndOrderFront:controller];
[window setContentView:view];