cppgfx  0.1.0
C++17 educational graphics library
Window

Everything related to windowing and OS integration. More...

Functions

void cppgfx::App::size (int w, int h)
 Set the size of the window. More...
 
void cppgfx::App::setTitle (const std::string &text)
 Set the title of the window. More...
 
void cppgfx::App::setFrameRate (float framerate)
 Set the maximum framerate limit in frames per second. More...
 
void cppgfx::App::fullscreen ()
 Switch to fullscreen mode. More...
 
void cppgfx::App::exitFullscreen ()
 Exit fullscreen mode. More...
 
void cppgfx::App::close ()
 Stop the application. More...
 
void cppgfx::App::focus ()
 Request the window to be focused. More...
 

Variables

sf::RenderWindow cppgfx::App::window
 The main window of your application. More...
 
bool cppgfx::App::darkTitleBar = true
 If the dark title bar should be used. More...
 
uint32_t cppgfx::App::width = 800
 The current width of the window [read only]. More...
 
uint32_t cppgfx::App::height = 600
 The current height of the window [read only]. More...
 
uint32_t cppgfx::App::displayWidth = 0
 The pixel width of the primary monitor [read only]. More...
 
uint32_t cppgfx::App::displayHeight = 0
 The pixel height of the primary monitor [read only]. More...
 
std::string cppgfx::App::title = "My cppgfx application"
 The current title of the window [read only]. More...
 
bool cppgfx::App::focused = true
 If the window is currently focused or not [read only]. More...
 
uint64_t cppgfx::App::frameCount = 0
 The frame count since the program started [read only]. More...
 
float cppgfx::App::frameTime = 0
 The elapsed time since the last frame in seconds [read only]. More...
 
float cppgfx::App::frameRate = 0
 The current frameRate [read only]. More...
 

Detailed Description

Everything related to windowing and OS integration.

Function Documentation

◆ close()

void cppgfx::App::close ( )

Stop the application.

This function will stop the application and close the window.

◆ exitFullscreen()

void cppgfx::App::exitFullscreen ( )

Exit fullscreen mode.

This function will exit fullscreen mode and restore the window to its previous size.

◆ focus()

void cppgfx::App::focus ( )

Request the window to be focused.

This function will not focus the window immediately, but instead request the window to be focused. On Windows for example, this is noticable by the taskbar icon flashing orange.

◆ fullscreen()

void cppgfx::App::fullscreen ( )

Switch to fullscreen mode.

This function will switch the window to fullscreen mode.

◆ setFrameRate()

void cppgfx::App::setFrameRate ( float  framerate)

Set the maximum framerate limit in frames per second.

This function will limit the framerate to the given value.

Parameters
framerateThe new framerate limit

◆ setTitle()

void cppgfx::App::setTitle ( const std::string &  text)

Set the title of the window.

This function will change the title of the window to the given text.

Parameters
textThe new title of the window

◆ size()

void cppgfx::App::size ( int  w,
int  h 
)

Set the size of the window.

This function will change the size of the window to the given width and height.

Parameters
wThe new width of the window in pixel
hThe new height of the window in pixel

Variable Documentation

◆ darkTitleBar

bool cppgfx::App::darkTitleBar = true

If the dark title bar should be used.

If this variable is set, the window will have a dark title bar instead of a white one.

Note
For now, this feature only affects Windows.

◆ displayHeight

uint32_t cppgfx::App::displayHeight = 0

The pixel height of the primary monitor [read only].

This variable is automatically updated and will not affect anything if you change it.

◆ displayWidth

uint32_t cppgfx::App::displayWidth = 0

The pixel width of the primary monitor [read only].

This variable is automatically updated and will not affect anything if you change it.

◆ focused

bool cppgfx::App::focused = true

If the window is currently focused or not [read only].

This variable is automatically updated and will not affect anything if you change it. Use focus() to request window to be focused.

◆ frameCount

uint64_t cppgfx::App::frameCount = 0

The frame count since the program started [read only].

This variable starts at 0 and is incremented for every frame. Keep in mind that using the framecount for timing is not recommended, since the framerate can vary. To get uniform, framerate independent movement, use the frameTime variable instead. This variable is automatically updated and will not affect anything if you change it.

◆ frameRate

float cppgfx::App::frameRate = 0

The current frameRate [read only].

This is the current frameRate in frames per second. It is intended for debugging purposes and diagnostics. This variable is automatically updated and will not affect anything if you change it.

◆ frameTime

float cppgfx::App::frameTime = 0

The elapsed time since the last frame in seconds [read only].

This is the time in seconds that has passed, since the last frame. Use this variable to get framerate independent motion, by multiplying the distance to move with this variable. This variable is automatically updated and will not affect anything if you change it.

◆ height

uint32_t cppgfx::App::height = 600

The current height of the window [read only].

This variable is automatically updated and will not affect anything if you change it. Use the size() function to change the size of the window.

◆ title

std::string cppgfx::App::title = "My cppgfx application"

The current title of the window [read only].

This variable is automatically updated and will not affect anything if you change it. Use the setTitle() function to change the title of the window.

◆ width

uint32_t cppgfx::App::width = 800

The current width of the window [read only].

This variable is automatically updated and will not affect anything if you change it. Use the size() function to change the size of the window.

◆ window

sf::RenderWindow cppgfx::App::window

The main window of your application.

This is the SFML RenderWindow which is used to draw everything. If you have the knowledge, you can use this variable to access the SFML API directly in order to draw more complex things.