diff --git a/PanoPainter-OSX/main.cpp b/PanoPainter-OSX/main.cpp index 6c85f52..3528840 100644 --- a/PanoPainter-OSX/main.cpp +++ b/PanoPainter-OSX/main.cpp @@ -141,6 +141,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime App::I.clear(); App::I.update(now - _prevTime); CGLFlushDrawable([glctx CGLContextObj]); + _prevTime = now; } //[[self openGLContext] flushBuffer]; @@ -156,7 +157,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime // return YES to have your layer redrawn return YES; } - + return kCVReturnSuccess; } @@ -328,6 +329,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime @end @implementation Controller - (void)windowWillClose:(NSNotification *)notification { + App::I.terminate(); [[NSApplication sharedApplication] terminate:nil]; } @end diff --git a/PanoPainter/GameViewController.m b/PanoPainter/GameViewController.m index db717cd..b03c157 100644 --- a/PanoPainter/GameViewController.m +++ b/PanoPainter/GameViewController.m @@ -374,6 +374,10 @@ NSThread* lock_thread; - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect { + static auto time = std::chrono::steady_clock::now(); + auto now = std::chrono::steady_clock::now(); + auto dt = std::chrono::duration(now - time); + [gl_lock lock]; if (!(App::I.redraw || App::I.animate)) { @@ -384,9 +388,10 @@ NSThread* lock_thread; [EAGLContext setCurrentContext:self.context]; [view bindDrawable]; App::I.clear(); - App::I.update(0); + App::I.update(dt.count()); [self.context presentRenderbuffer:GL_FRAMEBUFFER]; [gl_lock unlock]; + time = now; } @end diff --git a/data/layout.xml b/data/layout.xml index 906eef0..c79d017 100644 --- a/data/layout.xml +++ b/data/layout.xml @@ -614,6 +614,24 @@ + + + + + + + + + + + + + + + + + + @@ -636,6 +654,7 @@ --> + @@ -662,6 +681,9 @@ + + + @@ -725,6 +747,7 @@ +