diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 387b724a..052d05d7 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -559,7 +559,9 @@ void VulkanExampleBase::updateOverlay() ImGui::Text(deviceProperties.deviceName); ImGui::Text("%.2f ms/frame (%.1d fps)", (frameTimer * 1000.0f), lastFPS); - OnUpdateUIOverlay(); + ImGui::PushItemWidth(110.0f); + OnUpdateUIOverlay(UIOverlay); + ImGui::PopItemWidth(); ImGui::End(); ImGui::PopStyleVar(); @@ -569,8 +571,6 @@ void VulkanExampleBase::updateOverlay() UIOverlay->update(); } -//void VulkanExampleBase::getOverlayText(VulkanTextOverlay*) {} - void VulkanExampleBase::prepareFrame() { // Acquire the next image from the swap chain @@ -2153,4 +2153,4 @@ void VulkanExampleBase::setupSwapChain() swapChain.create(&width, &height, settings.vsync); } -void VulkanExampleBase::OnUpdateUIOverlay() {} \ No newline at end of file +void VulkanExampleBase::OnUpdateUIOverlay(vks::UIOverlay *overlay) {} \ No newline at end of file diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 4d4033f8..936779d7 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -66,6 +66,7 @@ private: uint32_t destHeight; bool resizing = false; vks::Benchmark benchmark; + vks::UIOverlay *UIOverlay = nullptr; // Called if the window is resized and some resources have to be recreatesd void windowResize(); protected: @@ -167,8 +168,6 @@ public: bool paused = false; - vks::UIOverlay *UIOverlay = nullptr; - // Use to adjust mouse rotation speed float rotationSpeed = 1.0f; // Use to adjust mouse zoom speed @@ -394,7 +393,7 @@ public: void submitFrame(); /** @brief (Virtual) Called when the UI overlay is updating, can be used to add custom elements to the overlay */ - virtual void OnUpdateUIOverlay(); + virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay); }; // OS specific macros for the example main entry points