summaryrefslogtreecommitdiff
path: root/engine/xe_window.hpp
diff options
context:
space:
mode:
authortylermurphy534 <tylermurphy534@gmail.com>2022-09-18 21:20:51 -0400
committertylermurphy534 <tylermurphy534@gmail.com>2022-09-18 21:20:51 -0400
commit8045b8ba04aae39a4cf9733e72413f648b6ebe2b (patch)
treef90a9bd50a2316d5077df99c9e8584afc76ed656 /engine/xe_window.hpp
downloadminecraftvulkan-8045b8ba04aae39a4cf9733e72413f648b6ebe2b.tar.gz
minecraftvulkan-8045b8ba04aae39a4cf9733e72413f648b6ebe2b.tar.bz2
minecraftvulkan-8045b8ba04aae39a4cf9733e72413f648b6ebe2b.zip
stanford dragon rendering
Diffstat (limited to 'engine/xe_window.hpp')
-rwxr-xr-xengine/xe_window.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/engine/xe_window.hpp b/engine/xe_window.hpp
new file mode 100755
index 0000000..bf80bd7
--- /dev/null
+++ b/engine/xe_window.hpp
@@ -0,0 +1,38 @@
+#pragma once
+
+#include <vulkan/vulkan_core.h>
+#define GLFW_INCLUDE_VULKAN
+#include <GLFW/glfw3.h>
+
+#include <string>
+namespace xe {
+
+class XeWindow {
+ public:
+ XeWindow(int w, int h, std::string name);
+ ~XeWindow();
+
+ XeWindow(const XeWindow &) = delete;
+ XeWindow &operator=(const XeWindow &);
+
+ 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; }
+ GLFWwindow *getGLFWwindow() const { return window; }
+
+ void createWindowSurface(VkInstance instance, VkSurfaceKHR *surface);
+
+ private:
+ static void framebufferResizeCallback(GLFWwindow *window, int width, int height);
+ void initWindow();
+
+ int width;
+ int height;
+ bool frameBufferResized = false;
+
+ std::string windowName;
+ GLFWwindow *window;
+};
+
+} \ No newline at end of file