65 lines
1.8 KiB
C++
65 lines
1.8 KiB
C++
#pragma once
|
|
#include "renderer/renderer.h"
|
|
#include "renderer/renderer_swapchain.h"
|
|
|
|
#include "vulkan/vulkan.hpp"
|
|
|
|
struct window_desc {
|
|
std::string title;
|
|
vk::Extent2D resolution;
|
|
GLFWmonitor* monitor = nullptr;
|
|
bool fullscreen = false;
|
|
bool resizable = true;
|
|
bool borderless = false;
|
|
bool vsync = true;
|
|
bool always_on_top = false;
|
|
bool transparent = false;
|
|
bool decorated = true;
|
|
bool focused = true;
|
|
bool focus_on_show = true;
|
|
bool maximized = false;
|
|
bool visible = true;
|
|
bool floating = false;
|
|
bool center_cursor = false;
|
|
bool create_surface = true;
|
|
};
|
|
|
|
class renderer_window {
|
|
friend class window_manager;
|
|
public:
|
|
explicit renderer_window(const window_desc& in_desc);
|
|
virtual ~renderer_window();
|
|
|
|
void set_title(const std::string& in_title) const;
|
|
void set_size(int in_width, int in_height);
|
|
|
|
void close() const;
|
|
bool should_close() const { return glfwWindowShouldClose(window); }
|
|
|
|
vk::Extent2D get_size() const {
|
|
int width, height;
|
|
glfwGetWindowSize(window, &width, &height);
|
|
return vk::Extent2D(width, height);
|
|
}
|
|
vk::Extent2D get_framebuffer_size() const {
|
|
int width, height;
|
|
glfwGetFramebufferSize(window, &width, &height);
|
|
return vk::Extent2D(width, height);
|
|
}
|
|
|
|
void update();
|
|
|
|
bool create_surface();
|
|
[[nodiscard]] auto get_surface() const { return surface; }
|
|
bool create_swap_chain(const renderer_swapchain::create_info& in_create_info);
|
|
[[nodiscard]] auto get_swap_chain() const { return swapchain; }
|
|
[[nodiscard]] void* get_native_handle() const;
|
|
protected:
|
|
virtual void on_resize(int in_width, int in_height);
|
|
virtual void on_glfw_close();
|
|
private:
|
|
GLFWwindow* window;
|
|
renderer_swapchain* swapchain;
|
|
vk::SurfaceKHR surface;
|
|
};
|