Class Window

Class Documentation

class inexor::vulkan_renderer::wrapper::Window

RAII wrapper class for GLFW windows.

Public Types

enum Mode

Values:

enumerator WINDOWED
enumerator FULLSCREEN
enumerator WINDOWED_FULLSCREEN

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(const Window&) = delete
Window(Window&&) = delete
~Window()
Window &operator=(const Window&) = delete
Window &operator=(Window&&) = delete
void wait_for_focus()

In case the window has been minimized, process events until it has been restored.

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.

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_keyboard_button_callback(GLFWkeyfun keyboard_button_callback)

Call glfwSetKeyCallback.

Parameters

key_input_callback – The keyboard input callback.

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 show()

Call glfwShowWindow.

bool should_close()

Check if the window is about to close.

Returns

true if the window will be closed.

inline GLFWwindow *get() const
inline std::uint32_t width() const
inline std::uint32_t height() const
inline Mode mode() const

Public Static Functions

static void poll()

Call glfwPollEvents.

Private Members

std::uint32_t m_width
std::uint32_t m_height
Mode m_mode
GLFWwindow *m_window = {nullptr}