ChessPlusPlus  WIP
cplusplus.com Community Project
chesspp::app::Application Class Reference

Represents the application and holds the current AppState. More...

#include <Application.hpp>

Public Member Functions

 Application (sf::RenderWindow &disp)
 Construct from an sf::RenderWindow. More...
 
template<class NewState , typename... Args>
void changeState (Args &&...args)
 Changes the current AppState by constructing a new one in place and destructing the old one. More...
 
int execute ()
 Begins running the application via the current AppState. More...
 
void stop () noexcept
 Causes execute() to stop running and return. More...
 
config::ResourcesConfigresourcesConfig () noexcept
 Gives access to the config::ResourcesConfig used by this Application and its AppState. More...
 

Detailed Description

Represents the application and holds the current AppState.

Constructor & Destructor Documentation

chesspp::app::Application::Application ( sf::RenderWindow &  disp)
inline

Construct from an sf::RenderWindow.

Also calls sf::RenderWindow::setVerticalSyncEnabled(true).

Parameters
dispThe sf::RenderWindow that will be drawn to. Must outlive this object.

Member Function Documentation

template<class NewState , typename... Args>
void chesspp::app::Application::changeState ( Args &&...  args)
inline

Changes the current AppState by constructing a new one in place and destructing the old one.

The old AppState instance is destructed within this function, so it must not be referenced anymore.

Template Parameters
NewStateThe type of AppState to construct.
Argsdeuced by the compiler from the parameter list.
Parameters
argsArguments to pass to the constructor of NewState
int chesspp::app::Application::execute ( )

Begins running the application via the current AppState.

This function blocks while the application is running. Application::stop() can be called to cause this function to return.

Returns
An appropriate return value for returning from main()
config::ResourcesConfig& chesspp::app::Application::resourcesConfig ( )
inlinenoexcept

Gives access to the config::ResourcesConfig used by this Application and its AppState.

Returns
The config::ResourcesConfig in use.
void chesspp::app::Application::stop ( )
noexcept

Causes execute() to stop running and return.


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