ge211
Window Class Reference

Detailed Description

Provides access to the game window and its properties.

Definition at line 12 of file ge211_window.h.

Public Member Functions

Dimensions get_dimensions () const noexcept
 Returns the current dimensions of this window.
 
void set_dimensions (Dimensions)
 Changes the size of the window. More...
 
Position get_position () const noexcept
 Gets the position of the upper-left corner of the window with respect to the upper-left corner of the screen. More...
 
void set_position (Position)
 Sets the position of the upper-left corner of the window with respect to the upper-left corner of the screen. More...
 
const char * get_title () const noexcept
 Returns the current title of this window. More...
 
void set_title (const std::string &) noexcept
 Changes the title of this window.
 
bool get_resizeable () const noexcept
 Returns whether the user can resize this window.
 
void set_resizeable (bool) noexcept
 Changes whether the user can resize this window.
 
bool get_fullscreen () const noexcept
 Returns whether the program is in fullscreen mode.
 
void set_fullscreen (bool)
 Sets whether the program should be in fullscreen mode. More...
 
Dimensions max_window_dimensions () const noexcept
 Returns the maximum dimensions for a non-fullscreen window. More...
 

Static Public Member Functions

static Dimensions max_fullscreen_dimensions () noexcept
 Returns the maximum dimensions for a fullscreen window. More...
 

Static Public Attributes

static const Position centered {SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED}
 A special value to pass to set_position(Position) to center the window on the screen. More...
 

Member Function Documentation

◆ get_position()

Position get_position ( ) const
noexcept

Gets the position of the upper-left corner of the window with respect to the upper-left corner of the screen.

Definition at line 63 of file ge211_window.cpp.

◆ get_title()

const char * get_title ( ) const
noexcept

Returns the current title of this window.

The returned pointer should not be freed by the client. It is borrowed from a buffer stored within the window, and should be valid until the next call to set_title(const std::string&). Copy it to a std::string if you need to hold it longer.

Definition at line 43 of file ge211_window.cpp.

◆ max_fullscreen_dimensions()

Dimensions max_fullscreen_dimensions ( )
staticnoexcept

Returns the maximum dimensions for a fullscreen window.

Call this before switching to fullscreen mode, since if you fullscreen a smaller window, the video mode may change.

Definition at line 90 of file ge211_window.cpp.

◆ max_window_dimensions()

Dimensions max_window_dimensions ( ) const
noexcept

Returns the maximum dimensions for a non-fullscreen window.

This is the size of the screen, minus space reserved for the system (such as the Windows taskbar or Mac menu and dock).

Definition at line 97 of file ge211_window.cpp.

◆ set_dimensions()

void set_dimensions ( Dimensions  dims)

Changes the size of the window.

Throws exceptions::Environment_error if the dimensions are negative or outside the allowable range.

Definition at line 35 of file ge211_window.cpp.

◆ set_fullscreen()

void set_fullscreen ( bool  fullscreen)

Sets whether the program should be in fullscreen mode.

Throws exceptions::Host_error if change fails.

Definition at line 82 of file ge211_window.cpp.

◆ set_position()

void set_position ( Position  position)

Sets the position of the upper-left corner of the window with respect to the upper-left corner of the screen.

Definition at line 70 of file ge211_window.cpp.

Member Data Documentation

◆ centered

const Position centered {SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED}
static

A special value to pass to set_position(Position) to center the window on the screen.

Definition at line 29 of file ge211_window.h.


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