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

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 clear () noexcept
 Clear screen framebuffer.
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 set_title (const std::string &title)
 Set window title.
void append_title (const std::string &append)
 Append to window title from the settings.
void set_icon (const std::string &icon) noexcept
 Set window icon.
void handle_window_events (const SDL_Event &events)
 Process window specific events.
int screen_width () const noexcept
 Return the current drawable width in pixels.
int screen_height () const noexcept
 Return the current drawable height in pixels.
int virtual_screen_width () const noexcept
 Return the configured logical screen width.
int virtual_screen_height () const noexcept
 Return the configured logical screen height.
bool is_open () const noexcept
 Is the window open or closed.
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.
Window & operator= (const Window &)=delete
 Copy assignment operator.
Window & operator= (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

Handles events, input & display.

Definition at line 28 of file Window.hpp.

Constructor & Destructor Documentation

◆ Window() [1/3]

galaxy::Window::Window ( )

Window creation constructor.

Definition at line 31 of file Window.cpp.

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

◆ ~Window()

galaxy::Window::~Window ( )

Destructor.

Definition at line 152 of file Window.cpp.

◆ Window() [2/3]

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

Copy constructor.

Here is the call graph for this function:

◆ Window() [3/3]

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

Move constructor.

Here is the call graph for this function:

Member Function Documentation

◆ close()

void galaxy::Window::close ( )
noexcept

Close window.

This will exit game loop.

Definition at line 161 of file Window.cpp.

Here is the caller graph for this function:

◆ clear()

void galaxy::Window::clear ( )
noexcept

Clear screen framebuffer.

Definition at line 166 of file Window.cpp.

◆ swap()

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

Swap backbuffer with window framebuffer.

Definition at line 171 of file Window.cpp.

◆ show()

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

Show window.

Definition at line 177 of file Window.cpp.

Here is the caller graph for this function:

◆ hide()

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

Hide window.

Definition at line 182 of file Window.cpp.

Here is the caller graph for this function:

◆ minimize()

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

Minimize window.

Definition at line 187 of file Window.cpp.

Here is the caller graph for this function:

◆ maximize()

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

Maximize window.

Definition at line 193 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 199 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 205 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 210 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 215 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 225 of file Window.cpp.

Here is the caller graph for this function:

◆ set_title()

void galaxy::Window::set_title ( const std::string & title)

Set window title.

Parameters
appendString to set.

Definition at line 230 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 from the settings.

Does not preserve last append when called again.

Parameters
appendString to append.

Definition at line 235 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 241 of file Window.cpp.

Here is the caller graph for this function:

◆ handle_window_events()

void galaxy::Window::handle_window_events ( const SDL_Event & events)

Process window specific events.

Parameters
eventsSDL_Event containing latest event from PollEvent.

Definition at line 265 of file Window.cpp.

Here is the call graph for this function:

◆ screen_width()

int galaxy::Window::screen_width ( ) const
nodiscardnoexcept

Return the current drawable width in pixels.

Returns
Integer.

Definition at line 305 of file Window.cpp.

Here is the caller graph for this function:

◆ screen_height()

int galaxy::Window::screen_height ( ) const
nodiscardnoexcept

Return the current drawable height in pixels.

Returns
Integer.

Definition at line 310 of file Window.cpp.

Here is the caller graph for this function:

◆ virtual_screen_width()

int galaxy::Window::virtual_screen_width ( ) const
nodiscardnoexcept

Return the configured logical screen width.

Returns
Integer.

Definition at line 315 of file Window.cpp.

Here is the caller graph for this function:

◆ virtual_screen_height()

int galaxy::Window::virtual_screen_height ( ) const
nodiscardnoexcept

Return the configured logical screen height.

Returns
Integer.

Definition at line 320 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 325 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 330 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 335 of file Window.cpp.

◆ context()

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

Get SDL GL context.

Returns
Opaque handle (pointer).

Definition at line 340 of file Window.cpp.

◆ operator=() [1/2]

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

Copy assignment operator.

Here is the call graph for this function:

◆ operator=() [2/2]

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

Move assignment operator.

Here is the call graph for this function:

Member Data Documentation

◆ m_window

SDL_Window* galaxy::Window::m_window
private

SDL window handle.

Definition at line 234 of file Window.hpp.

◆ m_context

SDL_GLContext galaxy::Window::m_context
private

SDL OpenGL context.

Definition at line 239 of file Window.hpp.

◆ m_open

bool galaxy::Window::m_open
private

Window state flag.

Definition at line 244 of file Window.hpp.


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