mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Recreate Vulkan swapchain in LoadingScreen::render() when the dirty flag is set, so resizing the window during world loading no longer renders into a stale swapchain with mismatched framebuffers.
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <vulkan/vulkan.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
struct SDL_Window;
|
|
|
|
namespace wowee {
|
|
namespace rendering {
|
|
|
|
class VkContext;
|
|
|
|
class LoadingScreen {
|
|
public:
|
|
LoadingScreen();
|
|
~LoadingScreen();
|
|
|
|
bool initialize();
|
|
void shutdown();
|
|
|
|
void selectRandomImage();
|
|
|
|
// Render the loading screen with progress bar and status text (pure ImGui)
|
|
void render();
|
|
|
|
void setProgress(float progress) { loadProgress = progress; }
|
|
void setStatus(const std::string& status) { statusText = status; }
|
|
|
|
// Must be set before initialize() for Vulkan texture upload
|
|
void setVkContext(VkContext* ctx) { vkCtx = ctx; }
|
|
void setSDLWindow(SDL_Window* win) { sdlWindow = win; }
|
|
|
|
private:
|
|
bool loadImage(const std::string& path);
|
|
|
|
VkContext* vkCtx = nullptr;
|
|
SDL_Window* sdlWindow = nullptr;
|
|
|
|
// Vulkan texture for background image
|
|
VkImage bgImage = VK_NULL_HANDLE;
|
|
VkDeviceMemory bgMemory = VK_NULL_HANDLE;
|
|
VkImageView bgImageView = VK_NULL_HANDLE;
|
|
VkSampler bgSampler = VK_NULL_HANDLE;
|
|
VkDescriptorSet bgDescriptorSet = VK_NULL_HANDLE; // ImGui texture handle
|
|
|
|
std::vector<std::string> imagePaths;
|
|
int currentImageIndex = 0;
|
|
|
|
float loadProgress = 0.0f;
|
|
std::string statusText = "Loading...";
|
|
|
|
int imageWidth = 0;
|
|
int imageHeight = 0;
|
|
};
|
|
|
|
} // namespace rendering
|
|
} // namespace wowee
|