diff --git a/external/vcpkg b/external/vcpkg index ce35b1a..f9a99aa 160000 --- a/external/vcpkg +++ b/external/vcpkg @@ -1 +1 @@ -Subproject commit ce35b1a53aac26d7fcdb8ee1ef7a8e4eea02d27b +Subproject commit f9a99aa79c1309001e36572fa42d7d8edebfc451 diff --git a/src/Engine/Graphics/Vulkan/Window.cpp b/src/Engine/Graphics/Vulkan/Window.cpp index 7b65ebd..41ae61a 100644 --- a/src/Engine/Graphics/Vulkan/Window.cpp +++ b/src/Engine/Graphics/Vulkan/Window.cpp @@ -143,7 +143,10 @@ void Window::endFrame() { // graphics->waitDeviceIdle(); } -void Window::onWindowCloseEvent() {} +bool Window::shouldClose() const { + std::cout << "Checking if window should close: " << glfwWindowShouldClose((GLFWwindow*)windowHandle) << std::endl; + return glfwWindowShouldClose((GLFWwindow*)windowHandle); +} Gfx::PTexture2D Window::getBackBuffer() const { return PTexture2D(swapChainTextures[currentImageIndex]); } diff --git a/src/Engine/Graphics/Vulkan/Window.h b/src/Engine/Graphics/Vulkan/Window.h index 0e50bd2..5411e51 100644 --- a/src/Engine/Graphics/Vulkan/Window.h +++ b/src/Engine/Graphics/Vulkan/Window.h @@ -16,7 +16,7 @@ class Window : public Gfx::Window { virtual void beginFrame() override; virtual void endFrame() override; virtual Gfx::PTexture2D getBackBuffer() const override; - virtual void onWindowCloseEvent() override; + virtual bool shouldClose() const override; virtual void setKeyCallback(std::function callback) override; virtual void setMouseMoveCallback(std::function callback) override; virtual void setMouseButtonCallback(std::function callback) override; diff --git a/src/Engine/Graphics/Window.h b/src/Engine/Graphics/Window.h index fb8b905..111e919 100644 --- a/src/Engine/Graphics/Window.h +++ b/src/Engine/Graphics/Window.h @@ -13,7 +13,7 @@ class Window { virtual void pollInput() = 0; virtual void beginFrame() = 0; virtual void endFrame() = 0; - virtual void onWindowCloseEvent() = 0; + virtual bool shouldClose() const = 0; virtual PTexture2D getBackBuffer() const = 0; virtual void setKeyCallback(std::function callback) = 0; virtual void setMouseMoveCallback(std::function callback) = 0; @@ -36,6 +36,7 @@ class Window { float contentScaleX; float contentScaleY; bool paused = false; + bool closing = false; }; DEFINE_REF(Window) diff --git a/src/Engine/Window/Window.cpp b/src/Engine/Window/Window.cpp index ab5bd56..46ccdf3 100644 --- a/src/Engine/Window/Window.cpp +++ b/src/Engine/Window/Window.cpp @@ -40,7 +40,9 @@ void Window::setFocused(PView view) { gfxHandle->setMouseButtonCallback(mouseButtonFunction); gfxHandle->setScrollCallback(scrollFunction); gfxHandle->setFileCallback(fileFunction); - gfxHandle->setCloseCallback([this]() { owner->notifyWindowClosed(this); }); + gfxHandle->setCloseCallback([this]() { + owner->notifyWindowClosed(this); + }); } void Window::onResize(uint32 width, uint32 height) { diff --git a/src/Engine/Window/Window.h b/src/Engine/Window/Window.h index ffee7d9..d65161f 100644 --- a/src/Engine/Window/Window.h +++ b/src/Engine/Window/Window.h @@ -17,6 +17,7 @@ class Window { void setFocused(PView view); void onResize(uint32 width, uint32 height); constexpr bool isPaused() const { return gfxHandle->isPaused(); } + constexpr bool shouldClose() const { return gfxHandle->shouldClose(); } protected: PWindowManager owner;