galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::Window Class Referencefinal

RAII Window. Handles events, input & display. More...

#include <Window.hpp>

+ Collaboration diagram for galaxy::Window:

Public Member Functions

 Window ()
 Window creation constructor.
 
 ~Window ()
 Destructor.
 
void close () noexcept
 Close window.
 
void swap () const noexcept
 Swap backbuffer with window framebuffer.
 
void show () const noexcept
 Show window.
 
void hide () const noexcept
 Hide window.
 
void minimize () const noexcept
 Minimize window.
 
void maximize () const noexcept
 Maximize window.
 
void restore () const noexcept
 Restore window to previous *mize state.
 
void raise () const noexcept
 Raise the window to be on top of other windows.
 
void request_attention () const noexcept
 Flash window on taskbar for user attention.
 
void resize (const int width, const int height) const noexcept
 Resizes window.
 
void set_fullscreen (const bool fullscreen) const noexcept
 Toggle fullscreen.
 
void set_taskbar_progress (const float progress) noexcept
 Sets the taskbar icon progress overlay.
 
void append_title (const std::string &append)
 Append to window title.
 
void set_icon (const std::string &icon) noexcept
 Set window icon.
 
bool is_open () const noexcept
 Is the window open or closed.
 
glm::ivec2 get_pixel_size () noexcept
 Get window size in pixels.
 
float get_display_scale () const noexcept
 Get display content scale.
 
SDL_Window * handle () const noexcept
 Get SDL window pointer.
 
SDL_GLContext context () const noexcept
 Get SDL GL context.
 

Private Member Functions

 Window (const Window &)=delete
 Copy constructor.
 
 Window (Window &&)=delete
 Move constructor.
 
Windowoperator= (const Window &)=delete
 Copy assignment operator.
 
Windowoperator= (Window &&)=delete
 Move assignment operator.
 

Private Attributes

SDL_Window * m_window
 SDL window handle.
 
SDL_GLContext m_context
 SDL OpenGL context.
 
bool m_open
 Window state flag.
 

Detailed Description

RAII Window. Handles events, input & display.

Definition at line 29 of file Window.hpp.

Constructor & Destructor Documentation

◆ Window() [1/3]

galaxy::Window::Window ( )

Window creation constructor.

Definition at line 27 of file Window.cpp.

+ Here is the call graph for this function:

◆ ~Window()

galaxy::Window::~Window ( )

Destructor.

Definition at line 154 of file Window.cpp.

◆ Window() [2/3]

galaxy::Window::Window ( const Window & )
privatedelete

Copy constructor.

◆ Window() [3/3]

galaxy::Window::Window ( Window && )
privatedelete

Move constructor.

Member Function Documentation

◆ close()

void galaxy::Window::close ( )
noexcept

Close window.

This will exit game loop.

Definition at line 164 of file Window.cpp.

+ Here is the caller graph for this function:

◆ swap()

void galaxy::Window::swap ( ) const
noexcept

Swap backbuffer with window framebuffer.

Definition at line 169 of file Window.cpp.

◆ show()

void galaxy::Window::show ( ) const
noexcept

Show window.

Definition at line 174 of file Window.cpp.

+ Here is the caller graph for this function:

◆ hide()

void galaxy::Window::hide ( ) const
noexcept

Hide window.

Definition at line 179 of file Window.cpp.

+ Here is the caller graph for this function:

◆ minimize()

void galaxy::Window::minimize ( ) const
noexcept

Minimize window.

Definition at line 184 of file Window.cpp.

+ Here is the caller graph for this function:

◆ maximize()

void galaxy::Window::maximize ( ) const
noexcept

Maximize window.

Definition at line 190 of file Window.cpp.

+ Here is the caller graph for this function:

◆ restore()

void galaxy::Window::restore ( ) const
noexcept

Restore window to previous *mize state.

Definition at line 197 of file Window.cpp.

+ Here is the caller graph for this function:

◆ raise()

void galaxy::Window::raise ( ) const
noexcept

Raise the window to be on top of other windows.

Definition at line 204 of file Window.cpp.

+ Here is the caller graph for this function:

◆ request_attention()

void galaxy::Window::request_attention ( ) const
noexcept

Flash window on taskbar for user attention.

Definition at line 209 of file Window.cpp.

+ Here is the caller graph for this function:

◆ resize()

void galaxy::Window::resize ( const int width,
const int height ) const
noexcept

Resizes window.

Parameters
widthWidth of the window.
heightHeight of the window.

Definition at line 214 of file Window.cpp.

+ Here is the caller graph for this function:

◆ set_fullscreen()

void galaxy::Window::set_fullscreen ( const bool fullscreen) const
noexcept

Toggle fullscreen.

Parameters
fullscreenTrue for fullscreen mode, False for windowed mode.

Definition at line 220 of file Window.cpp.

+ Here is the caller graph for this function:

◆ set_taskbar_progress()

void galaxy::Window::set_taskbar_progress ( const float progress)
noexcept

Sets the taskbar icon progress overlay.

Parameters
progressClamps from 0.0f (0%) to 1.0f (100%).

Definition at line 226 of file Window.cpp.

+ Here is the caller graph for this function:

◆ append_title()

void galaxy::Window::append_title ( const std::string & append)

Append to window title.

Does not preserve last append when called again.

Parameters
appendString to append.

Definition at line 231 of file Window.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_icon()

void galaxy::Window::set_icon ( const std::string & icon)
noexcept

Set window icon.

Parameters
iconIcon to load in VFS.

Definition at line 237 of file Window.cpp.

+ Here is the caller graph for this function:

◆ is_open()

bool galaxy::Window::is_open ( ) const
nodiscardnoexcept

Is the window open or closed.

Returns
Boolean.

Definition at line 261 of file Window.cpp.

+ Here is the caller graph for this function:

◆ get_pixel_size()

glm::ivec2 galaxy::Window::get_pixel_size ( )
nodiscardnoexcept

Get window size in pixels.

Returns
Integer vec2.

Definition at line 266 of file Window.cpp.

+ Here is the caller graph for this function:

◆ get_display_scale()

float galaxy::Window::get_display_scale ( ) const
nodiscardnoexcept

Get display content scale.

Returns
Main display scale.

Definition at line 274 of file Window.cpp.

+ Here is the caller graph for this function:

◆ handle()

SDL_Window * galaxy::Window::handle ( ) const
nodiscardnoexcept

Get SDL window pointer.

Returns
Raw sdl window pointer.

Definition at line 279 of file Window.cpp.

◆ context()

SDL_GLContext galaxy::Window::context ( ) const
nodiscardnoexcept

Get SDL GL context.

Returns
Opaque handle (pointer).

Definition at line 284 of file Window.cpp.

◆ operator=() [1/2]

Window & galaxy::Window::operator= ( const Window & )
privatedelete

Copy assignment operator.

◆ operator=() [2/2]

Window & galaxy::Window::operator= ( Window && )
privatedelete

Move assignment operator.

Member Data Documentation

◆ m_window

SDL_Window* galaxy::Window::m_window
private

SDL window handle.

Definition at line 192 of file Window.hpp.

◆ m_context

SDL_GLContext galaxy::Window::m_context
private

SDL OpenGL context.

Definition at line 197 of file Window.hpp.

◆ m_open

bool galaxy::Window::m_open
private

Window state flag.

Definition at line 202 of file Window.hpp.


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