CwWindow.hpp
1 #pragma once 2 3 #define GLFW_INCLUDE_VULKAN 4 #include <GLFW/glfw3.h> 5 6 #include <glm/glm.hpp> 7 8 class CwWindow { 9 public: 10 bool FrameBufferResized = false; 11 CwWindow() { 12 glfwInit(); 13 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); 14 glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); 15 Window = glfwCreateWindow(800, 800, "App", nullptr, nullptr); 16 glfwSetWindowUserPointer(Window, this); 17 glfwSetFramebufferSizeCallback(Window, FrameBufferResizedCallback); 18 }; 19 static void FrameBufferResizedCallback(GLFWwindow* window, int width, int height) { 20 auto app = reinterpret_cast<CwWindow*>(glfwGetWindowUserPointer(window)); 21 app->FrameBufferResized = true; 22 } 23 ~CwWindow() { glfwDestroyWindow(Window); }; 24 GLFWwindow* Window = NULL; 25 };