pass overlay member to virtual update function

This commit is contained in:
saschawillems 2017-10-30 12:36:44 +01:00
parent f6af0bde03
commit ab407f5346
2 changed files with 6 additions and 7 deletions

View file

@ -559,7 +559,9 @@ void VulkanExampleBase::updateOverlay()
ImGui::Text(deviceProperties.deviceName); ImGui::Text(deviceProperties.deviceName);
ImGui::Text("%.2f ms/frame (%.1d fps)", (frameTimer * 1000.0f), lastFPS); ImGui::Text("%.2f ms/frame (%.1d fps)", (frameTimer * 1000.0f), lastFPS);
OnUpdateUIOverlay(); ImGui::PushItemWidth(110.0f);
OnUpdateUIOverlay(UIOverlay);
ImGui::PopItemWidth();
ImGui::End(); ImGui::End();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
@ -569,8 +571,6 @@ void VulkanExampleBase::updateOverlay()
UIOverlay->update(); UIOverlay->update();
} }
//void VulkanExampleBase::getOverlayText(VulkanTextOverlay*) {}
void VulkanExampleBase::prepareFrame() void VulkanExampleBase::prepareFrame()
{ {
// Acquire the next image from the swap chain // Acquire the next image from the swap chain
@ -2153,4 +2153,4 @@ void VulkanExampleBase::setupSwapChain()
swapChain.create(&width, &height, settings.vsync); swapChain.create(&width, &height, settings.vsync);
} }
void VulkanExampleBase::OnUpdateUIOverlay() {} void VulkanExampleBase::OnUpdateUIOverlay(vks::UIOverlay *overlay) {}

View file

@ -66,6 +66,7 @@ private:
uint32_t destHeight; uint32_t destHeight;
bool resizing = false; bool resizing = false;
vks::Benchmark benchmark; vks::Benchmark benchmark;
vks::UIOverlay *UIOverlay = nullptr;
// Called if the window is resized and some resources have to be recreatesd // Called if the window is resized and some resources have to be recreatesd
void windowResize(); void windowResize();
protected: protected:
@ -167,8 +168,6 @@ public:
bool paused = false; bool paused = false;
vks::UIOverlay *UIOverlay = nullptr;
// Use to adjust mouse rotation speed // Use to adjust mouse rotation speed
float rotationSpeed = 1.0f; float rotationSpeed = 1.0f;
// Use to adjust mouse zoom speed // Use to adjust mouse zoom speed
@ -394,7 +393,7 @@ public:
void submitFrame(); void submitFrame();
/** @brief (Virtual) Called when the UI overlay is updating, can be used to add custom elements to the overlay */ /** @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 // OS specific macros for the example main entry points