Select Git revision
window.hpp 4.61 KiB
// file : liblava/frame/window.hpp
// copyright : Copyright (c) 2018-present, Lava Block OÜ
// license : MIT; see accompanying LICENSE file
#pragma once
#include <liblava/frame/input.hpp>
#include <liblava/core/data.hpp>
#include <liblava/core/math.hpp>
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
#include <optional>
// fwd
struct GLFWwindow;
namespace lava {
constexpr name _default_ = "default";
constexpr name _window_file_ = "window.json";
constexpr name _x_ = "x";
constexpr name _y_ = "y";
constexpr name _width_ = "width";
constexpr name _height_ = "height";
constexpr name _fullscreen_ = "fullscreen";
constexpr name _floating_ = "floating";
constexpr name _resizable_ = "resizable";
constexpr name _decorated_ = "decorated";
constexpr name _maximized_ = "maximized";
constexpr name _monitor_ = "monitor";
struct window : id_obj {
struct state {
using optional = std::optional<window::state>;
explicit state() {}
i32 x = 0;
i32 y = 0;
ui32 width = 0;
ui32 height = 0;
bool fullscreen = false;
bool floating = false;
bool resizable = true;
bool decorated = true;
bool maximized = false;
index monitor = 0;
};
using ptr = std::shared_ptr<window>;
using event = std::function<void(ptr)>;
using map = std::map<id, ptr>;
using ref = window const&;
window() = default;
explicit window(name title) : title(title) {}
bool create(state::optional state = {});
void destroy();
state get_state() const;
void set_title(name text);
name get_title() const { return str(title); }