Set viewUpdated=true for macOS scroll wheel, open vulkanExamples window in front of Xcode, accept mouse click-through on macOS

This commit is contained in:
Stephen Saunders 2022-07-06 21:35:07 -04:00
parent 8bc8d14cf2
commit a184bd7007
3 changed files with 10 additions and 1 deletions

View file

@ -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()

View file

@ -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;

View file

@ -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) {