Class Window¶
Defined in File window.hpp
Class Documentation¶
-
class Window¶
RAII wrapper class for GLFW windows.
Public Functions
-
Window(const std::string &title, std::uint32_t width, std::uint32_t height, bool visible, bool resizable, Mode mode)¶
Default constructor.
- Parameters:
title – The title of the window. This will be displayed in the window bar.
width – The width of the window.
height – The height of the window.
visible – True if the window is visible after creation, false otherwise.
resizable – True if the window should be resizable, false otherwise.
-
~Window()¶
-
inline std::array<int, 2> get_framebuffer_size() const¶
-
inline std::uint32_t height() const¶
-
void set_cursor_position_callback(GLFWcursorposfun cursor_pos_callback)¶
Call glfwSetCursorPosCallback.
- Parameters:
cursor_pos_callback – They cursor position callback.
-
void set_mouse_button_callback(GLFWmousebuttonfun mouse_button_callback)¶
Call glfwSetMouseButtonCallback.
- Parameters:
mouse_button_callback – The mouse button callback.
-
void set_mouse_scroll_callback(GLFWscrollfun mouse_scroll_callback)¶
Call glfwSetScrollCallback.
- Parameters:
mouse_scroll_callback – The mouse scroll callback.
-
void set_keyboard_button_callback(GLFWkeyfun keyboard_button_callback)¶
Call glfwSetKeyCallback.
- Parameters:
key_input_callback – The keyboard input callback.
-
void set_resize_callback(GLFWframebuffersizefun frame_buffer_resize_callback)¶
Set up the window resize callback.
- Parameters:
frame_buffer_resize_callback – The window resize callback.
-
void set_title(const std::string &title)¶
Change the window title.
- Parameters:
title – The new title of the window.
-
void set_user_ptr(void *user_ptr)¶
Set the GLFW window user pointer.
- Parameters:
user_ptr – The window user pointer.
-
bool should_close()¶
Check if the window is about to close.
- Returns:
trueif the window will be closed.
-
void show()¶
Call glfwShowWindow.
-
inline std::uint32_t width() const¶
-
inline auto window() const¶
-
void wait_for_focus()¶
In case the window has been minimized, process events until it has been restored.
Public Static Functions
-
static void poll()¶
Call glfwPollEvents.
-
Window(const std::string &title, std::uint32_t width, std::uint32_t height, bool visible, bool resizable, Mode mode)¶