![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Handles events, input & display. More...
#include <Window.hpp>
Public Member Functions | |
Window (const WindowSettings &settings) | |
Window creation constructor. | |
~Window () | |
Destructor. | |
bool | is_open () const |
Checks if window is currently open or not. | |
void | close () |
Closes the current window. | |
void | destroy () |
Destroys Window and related context and data. | |
void | poll_events () |
Poll for events. | |
void | resize (const int width, const int height) |
Resizes window. | |
void | request_attention () |
Notify's user of an event without interrupting. | |
void | focus () const |
Force window into focus. | |
void | maximize () |
Maximize window. | |
void | restore () |
Restore window. | |
void | minimize () const |
Minimize window. | |
void | fullscreen () |
Set window into borderless fullscreen mode. | |
void | set_title (const std::string &title) |
Set window title. | |
void | append_title (const std::string &append) |
Append to window title. | |
void | set_icon (const std::string &icon) |
Set window icon. | |
void | set_icon (std::span< std::uint8_t > buffer) |
Set window icon. | |
void | set_dispatcher (entt::dispatcher *dispatcher) |
Set current event dispatcher to use. | |
bool | is_focused () const |
Check if windows is in focus. | |
int | window_width () const |
int | window_height () const |
int | frame_width () const |
int | frame_height () const |
float | aspect_ratio () const |
template<meta::is_input_device Device> | |
Device & | get_input () |
Get a window input device. | |
const meta::vector< std::string > & | get_drop_paths () const |
Get a list of paths dropped on window. | |
glm::ivec2 | get_framebuffer_size () |
Get framebuffer size taking into account DPI. | |
glm::vec2 | get_content_scale () |
Get window content scale. | |
float | get_content_scale_max () |
Get max window content scale. | |
GLFWwindow * | handle () |
Retrieve pointer to GLFWwindow object. | |
Private Member Functions | |
Window ()=delete | |
Constructor. | |
Window (const Window &)=delete | |
Copy constructor. | |
Window (Window &&)=delete | |
Move constructor. | |
Window & | operator= (const Window &)=delete |
Copy assignment operator. | |
Window & | operator= (Window &&)=delete |
Move assignment operator. | |
Private Attributes | |
std::string | m_title |
Window title. | |
int | m_window_width |
Width of window (or fullscreen). | |
int | m_window_height |
Height of window (or fullscreen). | |
int | m_frame_width |
The virtual or final framebuffer width. | |
int | m_frame_height |
The virtual or final framebuffer height. | |
float | m_aspect_ratio |
Window aspect ratio. | |
GLFWwindow * | m_window |
GLFW window data. | |
entt::dispatcher * | m_dispatcher |
Currently active event dispatcher. | |
GLFWallocator | m_glfw_allocator |
Custom GLFW window allocator. | |
input::Keyboard | m_keyboard |
Keyboard assigned to window. | |
input::Mouse | m_mouse |
Mouse assigned to window. | |
input::Cursor | m_cursor |
Mouse cursor. | |
input::Clipboard | m_clipboard |
Clipboard access. | |
meta::vector< std::string > | m_drop_paths |
Cache of last dropped paths. | |
Handles events, input & display.
Definition at line 28 of file Window.hpp.
galaxy::core::Window::Window | ( | const WindowSettings & | settings | ) |
Window creation constructor.
Calls open().
settings | Settings of the window. |
Definition at line 60 of file Window.cpp.
galaxy::core::Window::~Window | ( | ) |
|
privatedelete |
Constructor.
|
privatedelete |
Copy constructor.
|
privatedelete |
Move constructor.
|
nodiscard |
Checks if window is currently open or not.
Definition at line 574 of file Window.cpp.
void galaxy::core::Window::close | ( | ) |
Closes the current window.
Internally, sets isOpen to false.
Definition at line 579 of file Window.cpp.
void galaxy::core::Window::destroy | ( | ) |
Destroys Window and related context and data.
Definition at line 584 of file Window.cpp.
void galaxy::core::Window::poll_events | ( | ) |
Poll for events.
Definition at line 603 of file Window.cpp.
void galaxy::core::Window::resize | ( | const int | width, |
const int | height ) |
Resizes window.
width | Width of the window. |
height | Height of the window. |
Definition at line 608 of file Window.cpp.
void galaxy::core::Window::request_attention | ( | ) |
Notify's user of an event without interrupting.
Think like windows flashing tray icon.
Definition at line 616 of file Window.cpp.
void galaxy::core::Window::focus | ( | ) | const |
Force window into focus.
Definition at line 621 of file Window.cpp.
void galaxy::core::Window::maximize | ( | ) |
Maximize window.
Definition at line 626 of file Window.cpp.
void galaxy::core::Window::restore | ( | ) |
Restore window.
Definition at line 632 of file Window.cpp.
void galaxy::core::Window::minimize | ( | ) | const |
Minimize window.
Definition at line 638 of file Window.cpp.
void galaxy::core::Window::fullscreen | ( | ) |
Set window into borderless fullscreen mode.
Definition at line 643 of file Window.cpp.
void galaxy::core::Window::set_title | ( | const std::string & | title | ) |
Set window title.
title | New title to set window to. |
Definition at line 500 of file Window.cpp.
void galaxy::core::Window::append_title | ( | const std::string & | append | ) |
Append to window title.
append | Appends to existing title, does not preserve last append when called again. |
Definition at line 505 of file Window.cpp.
void galaxy::core::Window::set_icon | ( | const std::string & | icon | ) |
void galaxy::core::Window::set_icon | ( | std::span< std::uint8_t > | buffer | ) |
Set window icon.
buffer | Memory buffer containing pixels. |
Definition at line 545 of file Window.cpp.
void galaxy::core::Window::set_dispatcher | ( | entt::dispatcher * | dispatcher | ) |
Set current event dispatcher to use.
dispatcher | Event dispatcher to use for processing input, etc. |
Definition at line 569 of file Window.cpp.
|
nodiscard |
Check if windows is in focus.
Definition at line 652 of file Window.cpp.
|
nodiscard |
Definition at line 657 of file Window.cpp.
|
nodiscard |
Definition at line 662 of file Window.cpp.
|
nodiscard |
Definition at line 667 of file Window.cpp.
|
nodiscard |
Definition at line 672 of file Window.cpp.
|
nodiscard |
Definition at line 677 of file Window.cpp.
|
inlinenodiscard |
Get a window input device.
Device | The type of input device to get. Constrained to a derived InputDevice. |
Definition at line 314 of file Window.hpp.
|
nodiscard |
Get a list of paths dropped on window.
Reset when a new path is dropped.
Definition at line 682 of file Window.cpp.
|
nodiscard |
Get framebuffer size taking into account DPI.
Definition at line 687 of file Window.cpp.
|
nodiscard |
Get window content scale.
Definition at line 695 of file Window.cpp.
|
nodiscard |
Get max window content scale.
Definition at line 703 of file Window.cpp.
|
nodiscard |
Retrieve pointer to GLFWwindow object.
Definition at line 709 of file Window.cpp.
|
private |
Window title.
Definition at line 245 of file Window.hpp.
|
private |
Width of window (or fullscreen).
Definition at line 250 of file Window.hpp.
|
private |
Height of window (or fullscreen).
Definition at line 255 of file Window.hpp.
|
private |
The virtual or final framebuffer width.
Definition at line 260 of file Window.hpp.
|
private |
The virtual or final framebuffer height.
Definition at line 265 of file Window.hpp.
|
private |
Window aspect ratio.
Definition at line 270 of file Window.hpp.
|
private |
GLFW window data.
Definition at line 275 of file Window.hpp.
|
private |
Currently active event dispatcher.
Definition at line 280 of file Window.hpp.
|
private |
Custom GLFW window allocator.
Definition at line 285 of file Window.hpp.
|
private |
Keyboard assigned to window.
Definition at line 290 of file Window.hpp.
|
private |
Mouse assigned to window.
Definition at line 295 of file Window.hpp.
|
private |
Mouse cursor.
Definition at line 300 of file Window.hpp.
|
private |
Clipboard access.
Definition at line 305 of file Window.hpp.
|
private |
Cache of last dropped paths.
Definition at line 310 of file Window.hpp.