diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 5878252d..2c2d350b 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -1549,6 +1549,8 @@ dispatch_group_t concurrentGroup; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + [NSApp activateIgnoringOtherApps:YES]; // SRS - Make sure app window launches in front of Xcode window + concurrentGroup = dispatch_group_create(); dispatch_queue_t concurrentQueue = dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0); dispatch_group_async(concurrentGroup, concurrentQueue, ^{ @@ -1628,6 +1630,11 @@ static CVReturn displayLinkOutputCallback(CVDisplayLinkRef displayLink, const CV return YES; } +- (BOOL)acceptsFirstMouse:(NSEvent *)event +{ + return YES; +} + - (void)keyDown:(NSEvent*)event { switch (event.keyCode) @@ -1751,6 +1758,7 @@ static CVReturn displayLinkOutputCallback(CVDisplayLinkRef displayLink, const CV short wheelDelta = [event deltaY]; vulkanExample->camera.translate(glm::vec3(0.0f, 0.0f, -(float)wheelDelta * 0.05f * vulkanExample->camera.movementSpeed)); + vulkanExample->viewUpdated = true; } // SRS - Window resizing already handled by windowResize() in VulkanExampleBase::submitFrame() diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 6d5b28b8..03c5a2c9 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -96,7 +96,6 @@ class VulkanExampleBase { private: std::string getWindowTitle(); - bool viewUpdated = false; uint32_t destWidth; uint32_t destHeight; bool resizing = false; @@ -177,6 +176,7 @@ protected: public: bool prepared = false; bool resized = false; + bool viewUpdated = false; uint32_t width = 1280; uint32_t height = 720; diff --git a/xcode/MVKExample.cpp b/xcode/MVKExample.cpp index 3073d2d9..ab6acc53 100644 --- a/xcode/MVKExample.cpp +++ b/xcode/MVKExample.cpp @@ -107,6 +107,7 @@ void MVKExample::mouseDragged(double x, double y) { void MVKExample::scrollWheel(short wheelDelta) { _vulkanExample->camera.translate(glm::vec3(0.0f, 0.0f, wheelDelta * 0.05f * _vulkanExample->camera.movementSpeed)); + _vulkanExample->viewUpdated = true; } void MVKExample::fullScreen(bool fullscreen) {