Reached shader lessons. Stopping to refactor code.
This commit is contained in:
2026-01-21 15:05:14 -05:00
parent 586ae1d18e
commit 15b3e294b5
21 changed files with 749 additions and 286 deletions

View File

@@ -2,8 +2,11 @@
#include <string>
#define VK_USE_PLATFORM_WIN32_KHR
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
struct FWindowConfig
{
@@ -20,14 +23,14 @@ public:
GlfwWindowManager();
~GlfwWindowManager();
GlfwWindowManager(const GlfwWindowManager&) = delete;
GlfwWindowManager& operator=(const GlfwWindowManager&) = delete;
// GlfwWindowManager(const GlfwWindowManager&) = delete;
// GlfwWindowManager& operator=(const GlfwWindowManager&) = delete;
GlfwWindowManager(GlfwWindowManager&& Other) noexcept;
GlfwWindowManager& operator=(GlfwWindowManager&& Other) noexcept;
// GlfwWindowManager(GlfwWindowManager&& Other) noexcept;
// GlfwWindowManager& operator=(GlfwWindowManager&& Other) noexcept;
void Initialize(const FWindowConfig& Config);
void Cleanup();
void Cleanup(VkInstance Instance);
bool ShouldClose() const;
void PollEvents();
@@ -35,12 +38,11 @@ public:
void SetTitle(const std::string& Title);
GLFWwindow* GetHandle() const { return Window; }
uint32_t GetWidth() const { return Width; }
uint32_t GetHeight() const { return Height; }
const std::string& GetTitle() const { return Title; }
bool IsInitialized() const { return Window != nullptr; }
uint32_t GetWidth() const { return Config.Width; }
uint32_t GetHeight() const { return Config.Height; }
const std::string& GetTitle() const { return Config.Title; }
VkSurfaceKHR CreateSurface(VkInstance Instance) const;
bool IsInitialized() const { return Window && Surface; }
void SetResizeCallback(GLFWwindowsizefun Callback);
void SetKeyCallback(GLFWkeyfun Callback);
@@ -48,14 +50,18 @@ public:
void SetCursorPositionCallback(GLFWcursorposfun Callback);
void SetScrollCallback(GLFWscrollfun Callback);
private:
// static bool bGlfwInitialized;
void InitializeGlfw();
void CreateSurface(VkInstance Instance);
GLFWwindow* Window = nullptr;
std::string Title;
uint32_t Width = 0;
uint32_t Height = 0;
static VkSurfaceKHR Surface;
static GLFWwindow* Window;
private:
FWindowConfig Config;
// VkSurfaceKHR Surface = VK_NULL_HANDLE;
void InitializeGlfw();
void DestroyWindow();
};