23#include <GLFW/glfw3.h>
27#include <raftel/input.hpp>
28#include <raftel/global_macros.hpp>
48 static std::unique_ptr<WindowSystem>
make();
95 static std::unique_ptr<Window>
make(
const char* title,
WindowSystem& ws,
int width = 0,
int height = 0,
bool fullscreen =
false);
100 NO_COPYABLE_OR_MOVABLE(
Window)
151 bool wasMaximized = false;
152 int lastWidth, lastHeight;
153 int lastPosX, lastPosY;
~Window()
Destructor that destroys the GLFW window and releases associated resources.
void toggleFullscreen(GLFWwindow *window)
Toggles between fullscreen and windowed modes.
void MakeContextCurrent()
Makes the window context current for OpenGL operations.
GLFWwindow * window_
The GLFW window instance.
void swapBuffers()
Swaps the front and back buffers, displaying the rendered content.
std::unique_ptr< Input > input
Input handler associated with 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.
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 onResize(int newWidth, int newHeight)
Handles window resize events, adjusting the OpenGL viewport accordingly.
glm::ivec2 getScreenSize()
Gets the current size of the window in screen coordinates.
bool isFullscreen
Whether the window is in fullscreen mode.
Window(GLFWwindow *w)
Private constructor used by the make method to initialize the window.
Manages the initialization and termination of the GLFW window system.
static std::unique_ptr< WindowSystem > make()
Creates and initializes the WindowSystem.
WindowSystem()
Default constructor for WindowSystem.
WindowSystem(WindowSystem &&other) noexcept
Move constructor for WindowSystem.
~WindowSystem() noexcept
Destructor that terminates the GLFW library if necessary.
constexpr float SCREEN_HEIGHT
Default height of the screen in pixels.
constexpr float SCREEN_WIDTH
Default width of the screen in pixels.