vktutorial/hk_window.hpp

39 lines
1021 B
C++
Raw Normal View History

2024-02-21 13:28:50 +08:00
#pragma once
#include <string>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
namespace hk
{
class Window
{
public:
Window(int w, int h, const std::string& name);
~Window();
Window(const Window&) = delete;
Window &operator=(const Window&) = delete;
bool shouldClose() { return glfwWindowShouldClose(m_window); }
VkExtent2D getExtend() { return {static_cast<uint32_t>(m_width), static_cast<uint32_t>(m_height)}; }
2024-02-21 15:42:32 +08:00
bool wasWindowResized() { return m_framebufferResized; }
void resetWindowResizedFlag() { m_framebufferResized = false; }
2024-02-21 13:28:50 +08:00
void createWindowSurface(VkInstance instance, VkSurfaceKHR *surface);
private:
2024-02-21 15:42:32 +08:00
static void framebufferResizeCallback(GLFWwindow* window, int width, int height);
2024-02-21 13:28:50 +08:00
void initWindow();
2024-02-21 15:42:32 +08:00
int m_width;
int m_height;
bool m_framebufferResized = false;
2024-02-21 13:28:50 +08:00
std::string m_windowName;
GLFWwindow *m_window;
};
} // namespace lve