SleakEngine 0.1.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::Window Class Reference

#include <Window.hpp>

Public Member Functions

 Window ()
 Constructs a window with the default size and no title.
 Window (const Window &)=delete
 Window (int width, int height, std::string name)
 Constructs a window with the given size and title.
 ~Window ()
 Destroys the SDL window and shuts down SDL.
void Close ()
 Marks the window for close; actual teardown happens in the destructor.
bool GetIsFullScreen ()
 True if the window is currently fullscreen.
SDL_Window * GetSDLWindow ()
 Returns the underlying SDL window handle.
std::string GetWindowTitle ()
 Returns the window title.
bool InitializeWindow ()
Window & operator= (const Window &)=delete
void SetFullScreen (bool bEnable)
 Enables or disables fullscreen mode.
void SetImGuiReady (bool ready)
 Marks whether ImGui is ready to receive SDL events.
void SetRelativeMouseMode (bool enabled)
 Enables or disables relative (locked, delta-only) mouse mode.
bool ShouldClose ()
 True once the window has received a close request.
void ToggleFullScreen ()
 Flips between fullscreen and windowed mode.
void Update ()

Static Public Member Functions

static int GetHeight ()
 Returns the current window height in pixels.
static int GetWidth ()
 Returns the current window width in pixels.

Detailed Description

SDL window wrapper: owns the native window and pumps SDL events into engine Events. Application owns exactly one.

Definition at line 18 of file Window.hpp.

Constructor & Destructor Documentation

◆ Window() [1/3]

Sleak::Window::Window ( )

Constructs a window with the default size and no title.

Definition at line 17 of file Window.cpp.

◆ Window() [2/3]

Sleak::Window::Window ( int width,
int height,
std::string name )

Constructs a window with the given size and title.

Definition at line 19 of file Window.cpp.

◆ ~Window()

Sleak::Window::~Window ( )

Destroys the SDL window and shuts down SDL.

Definition at line 26 of file Window.cpp.

◆ Window() [3/3]

Sleak::Window::Window ( const Window & )
delete

Member Function Documentation

◆ Close()

void Sleak::Window::Close ( )

Marks the window for close; actual teardown happens in the destructor.

Definition at line 200 of file Window.cpp.

◆ GetHeight()

int Sleak::Window::GetHeight ( )
inlinestatic

Returns the current window height in pixels.

Definition at line 63 of file Window.hpp.

◆ GetIsFullScreen()

bool Sleak::Window::GetIsFullScreen ( )
inline

True if the window is currently fullscreen.

Definition at line 52 of file Window.hpp.

◆ GetSDLWindow()

SDL_Window * Sleak::Window::GetSDLWindow ( )
inline

Returns the underlying SDL window handle.

Definition at line 43 of file Window.hpp.

◆ GetWidth()

int Sleak::Window::GetWidth ( )
inlinestatic

Returns the current window width in pixels.

Definition at line 61 of file Window.hpp.

◆ GetWindowTitle()

std::string Sleak::Window::GetWindowTitle ( )
inline

Returns the window title.

Definition at line 45 of file Window.hpp.

◆ InitializeWindow()

bool Sleak::Window::InitializeWindow ( )

Creates the SDL window and picks the graphics API flag for the active renderer.

Definition at line 35 of file Window.cpp.

◆ operator=()

Window & Sleak::Window::operator= ( const Window & )
delete

◆ SetFullScreen()

void Sleak::Window::SetFullScreen ( bool bEnable)

Enables or disables fullscreen mode.

Definition at line 185 of file Window.cpp.

◆ SetImGuiReady()

void Sleak::Window::SetImGuiReady ( bool ready)
inline

Marks whether ImGui is ready to receive SDL events.

Definition at line 55 of file Window.hpp.

◆ SetRelativeMouseMode()

void Sleak::Window::SetRelativeMouseMode ( bool enabled)

Enables or disables relative (locked, delta-only) mouse mode.

Definition at line 196 of file Window.cpp.

◆ ShouldClose()

bool Sleak::Window::ShouldClose ( )
inline

True once the window has received a close request.

Definition at line 40 of file Window.hpp.

◆ ToggleFullScreen()

void Sleak::Window::ToggleFullScreen ( )
inline

Flips between fullscreen and windowed mode.

Definition at line 50 of file Window.hpp.

◆ Update()

void Sleak::Window::Update ( )

Pumps the SDL event queue, dispatching engine events (resize, input, close, ...).

Definition at line 87 of file Window.cpp.