SolarSim
Loading...
Searching...
No Matches
solarsim::Window Class Reference

Manages window creation, events, and GLFW context. More...

#include <window.hpp>

Public Member Functions

 Window (const uint32_t p_width=800, const uint32_t p_height=600, const char *p_title="solarsim")
 Create a new window.
 ~Window ()
bool shouldClose ()
 Check if window should close.
void swapBuffers ()
 Swap front and back buffers.
void pollEvents ()
 Process pending window events.
GLFWwindow * getNativeWindow () const
 Get native GLFW window handle.

Static Private Member Functions

static void framebuffer_size_callback (GLFWwindow *w, int p_width, int p_height)
 GLFW framebuffer resize callback.

Private Attributes

GLFWwindow * m_window

Detailed Description

Manages window creation, events, and GLFW context.

Note
Wraps GLFW window functionality
Warning
GLFW must be initialized before creating Window instances

Constructor & Destructor Documentation

◆ Window()

solarsim::Window::Window ( const uint32_t p_width = 800,
const uint32_t p_height = 600,
const char * p_title = "solarsim" )

Create a new window.

Parameters
p_widthWindow width in pixels
p_heightWindow height in pixels
p_titleWindow title
Exceptions
std::runtime_errorif window creation fails

◆ ~Window()

solarsim::Window::~Window ( )

Member Function Documentation

◆ framebuffer_size_callback()

void solarsim::Window::framebuffer_size_callback ( GLFWwindow * w,
int p_width,
int p_height )
staticprivate

GLFW framebuffer resize callback.

Parameters
wGLFW window that was resized
p_widthNew framebuffer width
p_heightNew framebuffer height
Note
Updates the aspect ratio of the primary camera if present

Update camera aspect ratio if found

◆ getNativeWindow()

GLFWwindow * solarsim::Window::getNativeWindow ( ) const
inline

Get native GLFW window handle.

Returns
GLFWwindow* Raw GLFW window pointer

◆ pollEvents()

void solarsim::Window::pollEvents ( )
inline

Process pending window events.

Note
Call this once per frame before rendering

◆ shouldClose()

bool solarsim::Window::shouldClose ( )
inline

Check if window should close.

Returns
bool True if window close requested

◆ swapBuffers()

void solarsim::Window::swapBuffers ( )
inline

Swap front and back buffers.

Note
Call this once per frame after rendering

Field Documentation

◆ m_window

GLFWwindow* solarsim::Window::m_window
private

Native GLFW window handle


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