58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#ifndef DISPLAY_HPP
|
|
#define DISPLAY_HPP
|
|
|
|
#include <GLFW/glfw3.h>
|
|
#include <glm/glm.hpp>
|
|
#include <vulkan/vulkan_raii.hpp>
|
|
|
|
#include "user_input.hpp"
|
|
#include <functional>
|
|
#include <string_view>
|
|
|
|
namespace rog::ui {
|
|
|
|
class display {
|
|
private:
|
|
GLFWwindow *handle;
|
|
std::string_view title;
|
|
|
|
user_input *input;
|
|
|
|
[[nodiscard]] static GLFWwindow *
|
|
create_window(glm::uvec2 extent, std::string_view title, void *user_data);
|
|
|
|
std::vector<std::function<void(glm::uvec2 extent)>> resize_callbacks = {};
|
|
|
|
public:
|
|
display(user_input *input, glm::uvec2 extent, std::string_view title);
|
|
|
|
~display();
|
|
|
|
display(const display &rhs);
|
|
|
|
display(display &&rhs) noexcept;
|
|
|
|
display &operator=(const display &rhs);
|
|
|
|
display &operator=(display &&rhs) noexcept;
|
|
|
|
[[nodiscard]] bool should_close() const noexcept;
|
|
|
|
[[nodiscard]] glm::uvec2 extent() const noexcept;
|
|
|
|
void poll_events();
|
|
|
|
[[nodiscard]] vk::raii::SurfaceKHR
|
|
create_surface(const vk::raii::Instance &instance);
|
|
|
|
void resize_callback(std::function<void(glm::uvec2 extent)> callback);
|
|
|
|
[[nodiscard]] GLFWwindow *raw() const noexcept;
|
|
|
|
void request_close() noexcept;
|
|
};
|
|
|
|
} // namespace rog::ui
|
|
|
|
#endif
|