Files
Copium/CopiumEngine/src/copium/core/Window.h
T
Tim Håkansson 4d2dfce31c Add Linux support
- Add linux build system using MakeGen
- Fix a swapchain validation error, likelydue to my linux system using a
  different vulkan version
- Make DescriptorPool take in amount of descriptors it needs, instead of
  allocating a mass amount for every pool, causing loads of RAM/VRAM usage
2025-08-09 21:42:15 +02:00

55 lines
1.4 KiB
C++

#pragma once
#include "copium/util/Common.h"
#include "copium/util/Enum.h"
#include <vulkan/vulkan.hpp>
#define CP_WINDOW_MODE_ENUMS \
Fullscreen, \
BorderlessWindowed, \
Windowed
CP_ENUM_CREATOR(Copium, WindowMode, CP_WINDOW_MODE_ENUMS);
struct GLFWwindow;
namespace Copium
{
class Window final
{
CP_DELETE_COPY_AND_MOVE_CTOR(Window);
private:
GLFWwindow* window;
VkSurfaceKHR surface;
int width;
int height;
public:
Window(const std::string& windowName, int width, int height, WindowMode mode);
~Window();
bool ShouldClose() const;
int GetWidth() const;
int GetHeight() const;
VkSurfaceKHR GetSurface() const;
GLFWwindow* GetWindow();
void GrabMouse(bool grap);
bool IsMouseGrabbed() const;
private:
void InitializeWindow(const std::string& windowName, int width, int height, WindowMode mode);
void InitializeSurface();
static void FramebufferResizeCallback(GLFWwindow* glfwWindow, int width, int height);
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
static void MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
static void MouseMoveCallback(GLFWwindow* window, double xpos, double ypos);
static void WindowFocusCallback(GLFWwindow* window, int focused);
static void MouseScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
};
}