Initial Gitea Commit
This commit is contained in:
61
GlfwWindowManager.h
Normal file
61
GlfwWindowManager.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
struct FWindowConfig
|
||||
{
|
||||
std::string Title = "Learning Vulkan";
|
||||
uint32_t Width = 800;
|
||||
uint32_t Height = 600;
|
||||
bool bResizable = false;
|
||||
bool bFullscreen = false;
|
||||
};
|
||||
|
||||
class GlfwWindowManager
|
||||
{
|
||||
public:
|
||||
GlfwWindowManager();
|
||||
~GlfwWindowManager();
|
||||
|
||||
GlfwWindowManager(const GlfwWindowManager&) = delete;
|
||||
GlfwWindowManager& operator=(const GlfwWindowManager&) = delete;
|
||||
|
||||
GlfwWindowManager(GlfwWindowManager&& Other) noexcept;
|
||||
GlfwWindowManager& operator=(GlfwWindowManager&& Other) noexcept;
|
||||
|
||||
void Initialize(const FWindowConfig& Config);
|
||||
void Cleanup();
|
||||
|
||||
bool ShouldClose() const;
|
||||
void PollEvents();
|
||||
void WaitEvents() const;
|
||||
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; }
|
||||
|
||||
VkSurfaceKHR CreateSurface(VkInstance Instance) const;
|
||||
|
||||
void SetResizeCallback(GLFWwindowsizefun Callback);
|
||||
void SetKeyCallback(GLFWkeyfun Callback);
|
||||
void SetMouseButtonCallback(GLFWmousebuttonfun Callback);
|
||||
void SetCursorPositionCallback(GLFWcursorposfun Callback);
|
||||
void SetScrollCallback(GLFWscrollfun Callback);
|
||||
|
||||
private:
|
||||
// static bool bGlfwInitialized;
|
||||
void InitializeGlfw();
|
||||
|
||||
GLFWwindow* Window = nullptr;
|
||||
std::string Title;
|
||||
uint32_t Width = 0;
|
||||
uint32_t Height = 0;
|
||||
|
||||
void DestroyWindow();
|
||||
};
|
||||
Reference in New Issue
Block a user