Files
Cheap-Vulkan-Renderer/cve_window.hpp

36 lines
957 B
C++

#pragma once
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#include <string>
namespace cve {
class CveWindow {
public:
CveWindow(int w, int h, std::string name);
~CveWindow();
CveWindow(const CveWindow &) = delete;
CveWindow &operator=(const CveWindow &) = delete;
bool shouldClose() { return glfwWindowShouldClose(window); };
VkExtent2D getExtent() { return { static_cast<uint32_t>(width), static_cast<uint32_t>(height) }; };
bool wasWindowResized() { return framebufferResized; };
void resetWindowResizedFlag() { framebufferResized = false; };
void createWindowSurface(VkInstance instance, VkSurfaceKHR *surface);
private:
static void framebufferResizedCallback(GLFWwindow *window, int width, int height);
void initWindow();
int width;
int height;
bool framebufferResized = false;
std::string windowName;
GLFWwindow *window;
};
}