minecraftvulkan/engine/xe_window.hpp
tylermurphy534 bc2a2d08c9 window icon
2022-09-26 21:24:28 -04:00

43 lines
No EOL
1.1 KiB
C++
Executable file

#pragma once
#include <vulkan/vulkan_core.h>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#include <GLFW/glfw3.h>
#include <stdexcept>
#include <string>
namespace xe {
class Window {
public:
Window(int w, int h, std::string name, const char *icon);
~Window();
Window(const Window &) = delete;
Window &operator=(const Window &);
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();
void setIcon(const char *icon);
int width;
int height;
bool frameBufferResized = false;
std::string windowName;
GLFWwindow *window;
};
}