Represents a single window in the system, supporting OpenGL context and input handling.
More...
#include <window.hpp>
|
| ~Window () |
| Destructor that destroys the GLFW window and releases associated resources.
|
|
void | MakeContextCurrent () |
| Makes the window context current for OpenGL operations.
|
|
bool | ShouldClose (bool allowEscapeKey=true) |
| Checks if the window should close, optionally checking for the Escape key.
|
|
void | clear () |
| Clears the window's buffer (color and depth).
|
|
void | swapBuffers () |
| Swaps the front and back buffers, displaying the rendered content.
|
|
glm::ivec2 | getScreenSize () |
| Gets the current size of the window in screen coordinates.
|
|
void | toggleFullscreen (GLFWwindow *window) |
| Toggles between fullscreen and windowed modes.
|
|
void | onResize (int newWidth, int newHeight) |
| Handles window resize events, adjusting the OpenGL viewport accordingly.
|
|
| Window (GLFWwindow *w) |
| Private constructor used by the make method to initialize the window.
|
|
|
static std::unique_ptr< Window > | make (const char *title, WindowSystem &ws, int width=0, int height=0, bool fullscreen=false) |
| Creates a new window with the specified properties.
|
|
|
std::unique_ptr< Input > | input |
| Input handler associated with the window.
|
|
GLFWwindow * | window_ |
| The GLFW window instance.
|
|
bool | isFullscreen = false |
| Whether the window is in fullscreen mode.
|
|
Represents a single window in the system, supporting OpenGL context and input handling.
The Window
class manages an individual window's properties and provides methods to interact with the OpenGL context. It supports features such as fullscreen toggling, resizing, and swapping buffers. Input handling is also integrated within this class.
Definition at line 83 of file window.hpp.
◆ Window()
Raftel::Window::Window |
( |
GLFWwindow * | w | ) |
|
Private constructor used by the make
method to initialize the window.
- Parameters
-
w | The GLFW window instance to associate with this Window object. |
◆ getScreenSize()
glm::ivec2 Raftel::Window::getScreenSize |
( |
| ) |
|
Gets the current size of the window in screen coordinates.
- Returns
- A
glm::ivec2
representing the width and height of the window.
◆ make()
static std::unique_ptr< Window > Raftel::Window::make |
( |
const char * | title, |
|
|
WindowSystem & | ws, |
|
|
int | width = 0, |
|
|
int | height = 0, |
|
|
bool | fullscreen = false ) |
|
static |
Creates a new window with the specified properties.
- Parameters
-
title | The title of the window. |
ws | The window system to associate the window with. |
width | The width of the window (default 0 for fullscreen resolution). |
height | The height of the window (default 0 for fullscreen resolution). |
fullscreen | Whether the window should be fullscreen or not. |
- Returns
- A unique pointer to the created
Window
object, or nullptr
if creation fails.
◆ onResize()
void Raftel::Window::onResize |
( |
int | newWidth, |
|
|
int | newHeight ) |
Handles window resize events, adjusting the OpenGL viewport accordingly.
- Parameters
-
newWidth | The new width of the window. |
newHeight | The new height of the window. |
◆ ShouldClose()
bool Raftel::Window::ShouldClose |
( |
bool | allowEscapeKey = true | ) |
|
Checks if the window should close, optionally checking for the Escape key.
- Parameters
-
allowEscapeKey | Whether the Escape key should be allowed to close the window. |
- Returns
true
if the window should close, false
otherwise.
◆ toggleFullscreen()
void Raftel::Window::toggleFullscreen |
( |
GLFWwindow * | window | ) |
|
Toggles between fullscreen and windowed modes.
- Parameters
-
window | The GLFW window object to toggle. |
◆ input
std::unique_ptr<Input> Raftel::Window::input |
◆ isFullscreen
bool Raftel::Window::isFullscreen = false |
Whether the window is in fullscreen mode.
Definition at line 149 of file window.hpp.
◆ window_
GLFWwindow* Raftel::Window::window_ |
The GLFW window instance.
Definition at line 141 of file window.hpp.
The documentation for this class was generated from the following file:
- C:/Users/carlo/OneDrive/Documentos/GitHub/3PVG_PMG_24_mazcunyabla_folgadoba/include/raftel/window.hpp