Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::Window Class Reference

Class representing a window. More...

#include <Window.h>

Public Member Functions

 Window (const WindowProps &props)
 Constructs a window with the given properties.
 ~Window ()
 Destructor for the window.
u32 GetWidth () const
 Gets the width of the window.
u32 GetHeight () const
 Gets the height of the window.
const WindowPropsGetProps () const
 Retrieves the current window properties.
WindowPropsGetProps ()
 Retrieves a mutable reference to the window properties.
void SetEventCallback (const EventCallbackFn &callback)
 Sets the event callback function for the window.
void OnUpdate ()
 Updates the window state.
void * GetNativeWindow ()
 Gets the native window handle.

Detailed Description

Class representing a window.

This class provides an interface for creating and managing a window using GLFW. It includes methods for handling events, setting properties, and updating the window state. The class allows for flexible window management and integrates with the engine's event system.

Constructor & Destructor Documentation

◆ Window()

Raven::Window::Window ( const WindowProps & props)

Constructs a window with the given properties.

This constructor creates a window using GLFW, initializes it with the specified properties (such as title, size, VSync, etc.), and sets up the event callback function.

Parameters
propsThe window properties to use for creating the window.

◆ ~Window()

Raven::Window::~Window ( )

Destructor for the window.

This destructor cleans up resources associated with the window and shuts down GLFW.

Member Function Documentation

◆ GetHeight()

u32 Raven::Window::GetHeight ( ) const
inline

Gets the height of the window.

This method returns the current height of the window in pixels.

Returns
The height of the window.

◆ GetNativeWindow()

void * Raven::Window::GetNativeWindow ( )
inline

Gets the native window handle.

This method returns the native window handle, which can be passed to platform-specific APIs if necessary.

Returns
A pointer to the native window.

◆ GetProps() [1/2]

WindowProps & Raven::Window::GetProps ( )
inline

Retrieves a mutable reference to the window properties.

This allows direct modification of the window's runtime state. Useful for updating properties like the callback function at runtime.

Returns
A mutable reference to the current WindowProps instance.

◆ GetProps() [2/2]

const WindowProps & Raven::Window::GetProps ( ) const
inline

Retrieves the current window properties.

This method returns a reference to the window's properties, which include the title, size (width and height), maximized state, and the event callback.

Returns
A const reference to the current WindowProps instance representing this window's state.

◆ GetWidth()

u32 Raven::Window::GetWidth ( ) const
inline

Gets the width of the window.

This method returns the current width of the window in pixels.

Returns
The width of the window.

◆ OnUpdate()

void Raven::Window::OnUpdate ( )

Updates the window state.

This method should be called every frame to update the window's state, handle events, and refresh the window contents.

◆ SetEventCallback()

void Raven::Window::SetEventCallback ( const EventCallbackFn & callback)
inline

Sets the event callback function for the window.

This method allows the user to set a custom callback function that will be called when an event (such as a key press or window resize) occurs.

Parameters
callbackThe event callback function.

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