Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Window::Resource::Window Class Reference

#include <Window.hpp>

Public Member Functions

 Window (uint32_t width, uint32_t height, const std::string &title, GLFWmonitor *monitor=nullptr, GLFWwindow *share=nullptr)
void Destroy ()
 Destroy the window.
bool ShouldClose () const
 Check if the window should close.
GLFWwindow * GetGLFWWindow () const
 Get a pointer to the GLFW window.
void SetTitle (std::string_view title)
 Set the window title.
glm::uvec2 GetSize () const
 Get the window size.
void SetSize (int width, int height)
 Set the window size.
void ToggleFullscreen ()
 Toggle fullscreen mode.
glm::vec2 GetMousePosition ()
 Get the current mouse position.
void SetResizable (bool resizable)
void MaskCursor ()
 Hide the cursor and lock it to the window.
void ShowCursor ()
 Show the cursor and unlock it from the window.
bool IsCursorMasked () const
 Check if the cursor is currently masked (hidden and locked).

Private Attributes

std::string _title
GLFWwindow * _window
GLFWmonitor * _monitor
GLFWwindow * _share
bool _isFullscreen = false
int _windowedX = 0
int _windowedY = 0
int _windowedWidth = 0
int _windowedHeight = 0

Constructor & Destructor Documentation

◆ Window()

Window::Resource::Window::Window ( uint32_t width,
uint32_t height,
const std::string & title,
GLFWmonitor * monitor = nullptr,
GLFWwindow * share = nullptr )

Member Function Documentation

◆ Destroy()

void Window::Resource::Window::Destroy ( )

Destroy the window.

◆ GetGLFWWindow()

GLFWwindow * Window::Resource::Window::GetGLFWWindow ( ) const
inline

Get a pointer to the GLFW window.

Returns
The GLFW window.

◆ GetMousePosition()

glm::vec2 Window::Resource::Window::GetMousePosition ( )
inline

Get the current mouse position.

Returns
A pair containing the x and y coordinates of the mouse.

◆ GetSize()

glm::uvec2 Window::Resource::Window::GetSize ( ) const

Get the window size.

This function will update the window size from the GLFW window content area and return it.

Returns
A vector of integers to store the size of the window.

◆ IsCursorMasked()

bool Window::Resource::Window::IsCursorMasked ( ) const
inline

Check if the cursor is currently masked (hidden and locked).

◆ MaskCursor()

void Window::Resource::Window::MaskCursor ( )
inline

Hide the cursor and lock it to the window.

◆ SetResizable()

void Window::Resource::Window::SetResizable ( bool resizable)
inline

◆ SetSize()

void Window::Resource::Window::SetSize ( int width,
int height )

Set the window size.

Parameters
widthThe new width of the window.
heightThe new height of the window.

◆ SetTitle()

void Window::Resource::Window::SetTitle ( std::string_view title)
inline

Set the window title.

Parameters
titleThe new title of the window.

◆ ShouldClose()

bool Window::Resource::Window::ShouldClose ( ) const
inline

Check if the window should close.

Returns
True if the window should close, false otherwise.

◆ ShowCursor()

void Window::Resource::Window::ShowCursor ( )
inline

Show the cursor and unlock it from the window.

◆ ToggleFullscreen()

void Window::Resource::Window::ToggleFullscreen ( )

Toggle fullscreen mode.

Member Data Documentation

◆ _isFullscreen

bool Window::Resource::Window::_isFullscreen = false
private

◆ _monitor

GLFWmonitor* Window::Resource::Window::_monitor
private

◆ _share

GLFWwindow* Window::Resource::Window::_share
private

◆ _title

std::string Window::Resource::Window::_title
private

◆ _window

GLFWwindow* Window::Resource::Window::_window
private

◆ _windowedHeight

int Window::Resource::Window::_windowedHeight = 0
private

◆ _windowedWidth

int Window::Resource::Window::_windowedWidth = 0
private

◆ _windowedX

int Window::Resource::Window::_windowedX = 0
private

◆ _windowedY

int Window::Resource::Window::_windowedY = 0
private

The documentation for this class was generated from the following files: