3#include "pixelbullet/input/input.h"
20struct ApplicationSpecification;
25 enum class WindowState
46 unsigned int GetHeight() const noexcept
50 glm::ivec2 GetSize() const noexcept
52 return { width_, height_ };
54 glm::ivec2 GetPosition() const noexcept
58 unsigned int GetFramebufferWidth() const noexcept
60 return static_cast<unsigned int>(GetFramebufferSize().x);
62 unsigned int GetFramebufferHeight() const noexcept
64 return static_cast<unsigned int>(GetFramebufferSize().y);
66 glm::ivec2 GetFramebufferSize() const noexcept
68 const auto size = fullscreen_ ? fullscreen_size_ : size_;
70 if (size.x > 0 && size.y > 0)
81 event_callback_ = callback;
83 void SetFramebufferResizeCallback(
const std::function<
void(uint32_t)>& callback)
85 framebuffer_resize_callback_ = callback;
88 [[nodiscard]]
const input::InputState& GetInputState() const noexcept
103 VkResult
CreateSurface(VkInstance instance,
const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface)
const;
134 GLFWwindow* window_ =
nullptr;
136 unsigned int width_ = 0, height_ = 0;
137 std::function<
void(
Event&)> event_callback_;
138 std::function<
void(uint32_t)> framebuffer_resize_callback_;
140 bool fullscreen_ = false;
141 bool focused_ = false;
142 glm::ivec2 size_{ 0, 0 };
143 glm::ivec2 fullscreen_size_{ 0, 0 };
144 glm::ivec2 position_{ 0, 0 };
145 input::InputState input_state_;
Definition filesystem.h:16
Definition virtual_path.h:10
WindowState GetWindowState() const noexcept
Returns the current window state.
Definition window.cc:312
void * GetNativeWindow() const noexcept
Returns the underlying native window pointer.
Definition window.h:94
void Maximize() noexcept
Maximizes the window.
Definition window.cc:286
bool IsFocused() const noexcept
Returns whether the window currently has focus.
Definition window.h:118
VkResult CreateSurface(VkInstance instance, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface) const
Creates a Vulkan surface for this window.
Definition window.cc:273
void Restore() noexcept
Restores the window from a minimized or maximized state.
Definition window.cc:294
void SetEventCallback(const std::function< void(Event &)> &callback)
Sets the callback that will be invoked when events occur.
Definition window.h:79
void SetIcon(const Filesystem &filesystem, const VirtualPath &iconPath)
Sets the window icon from an image file.
Definition window.cc:235
unsigned int GetWidth() const noexcept
Accessors for window size.
Definition window.h:42
bool IsMaximized() const noexcept
Returns whether the window is currently maximized.
Definition window.cc:307
void OnUpdate() noexcept
Polls for and processes events.
Definition window.cc:230
void Minimize() noexcept
Minimizes the window.
Definition window.cc:278
bool IsMinimized() const noexcept
Returns whether the window is currently minimized.
Definition window.cc:302
std::pair< const char **, uint32_t > GetInstanceExtensions() const
Retrieves the Vulkan instance extensions required by GLFW.
Definition window.cc:260
Contains configuration options for both the game and the engine.
Definition specification.h:145