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 process_events (entt::dispatcher &dispatcher)
 Handles all events for the window in this frame and sends to the dispatcher.
 
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.
 
Mouseget_mouse () noexcept
 Get mouse cursor.
 
Keyboardget_keyboard () noexcept
 Get keyboard.
 
glm::ivec2 get_pixel_size () noexcept
 Get window size in pixels.
 
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.
 
SDL_Event m_events
 Core event data.
 
Keyboard m_keyboard
 Keyboard assigned to window.
 
Mouse m_mouse
 Mouse assigned to window.
 

Detailed Description

RAII Window. Handles events, input & display.

Definition at line 32 of file Window.hpp.

Constructor & Destructor Documentation

◆ Window() [1/3]

galaxy::Window::Window ( )

Window creation constructor.

Definition at line 39 of file Window.cpp.

+ Here is the call graph for this function:

◆ ~Window()

galaxy::Window::~Window ( )

Destructor.

Definition at line 202 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

◆ process_events()

void galaxy::Window::process_events ( entt::dispatcher & dispatcher)

Handles all events for the window in this frame and sends to the dispatcher.

Parameters
dispatcherDispatcher to send event triggers to.

Definition at line 212 of file Window.cpp.

+ Here is the call graph for this function:

◆ close()

void galaxy::Window::close ( )
noexcept

Close window.

This will exit game loop.

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

◆ show()

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

Show window.

Definition at line 462 of file Window.cpp.

+ Here is the caller graph for this function:

◆ hide()

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

Hide window.

Definition at line 467 of file Window.cpp.

+ Here is the caller graph for this function:

◆ minimize()

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

Minimize window.

Definition at line 472 of file Window.cpp.

+ Here is the caller graph for this function:

◆ maximize()

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

Maximize window.

Definition at line 478 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 485 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 492 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 497 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 502 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 508 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 514 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 519 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 525 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 553 of file Window.cpp.

+ Here is the caller graph for this function:

◆ get_mouse()

Mouse & galaxy::Window::get_mouse ( )
nodiscardnoexcept

Get mouse cursor.

Returns
Mouse ref.

Definition at line 558 of file Window.cpp.

+ Here is the caller graph for this function:

◆ get_keyboard()

Keyboard & galaxy::Window::get_keyboard ( )
nodiscardnoexcept

Get keyboard.

Returns
Keyboard ref.

Definition at line 563 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 568 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 576 of file Window.cpp.

◆ context()

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

Get SDL GL context.

Returns
Opaque handle (pointer).

Definition at line 581 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 210 of file Window.hpp.

◆ m_context

SDL_GLContext galaxy::Window::m_context
private

SDL OpenGL context.

Definition at line 215 of file Window.hpp.

◆ m_open

bool galaxy::Window::m_open
private

Window state flag.

Definition at line 220 of file Window.hpp.

◆ m_events

SDL_Event galaxy::Window::m_events
private

Core event data.

Definition at line 225 of file Window.hpp.

◆ m_keyboard

Keyboard galaxy::Window::m_keyboard
private

Keyboard assigned to window.

Definition at line 230 of file Window.hpp.

◆ m_mouse

Mouse galaxy::Window::m_mouse
private

Mouse assigned to window.

Definition at line 235 of file Window.hpp.


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