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

The AppState class for the state of the chess gameplay. More...

#include <ChessPlusPlusState.hpp>

Inheritance diagram for chesspp::app::ChessPlusPlusState:
chesspp::app::AppState chesspp::SfmlEventHandler

Public Member Functions

 ChessPlusPlusState (Application &app, sf::RenderWindow &display)
 Construct from the Application and sf::RenderWindow to be used. More...
 
virtual void onRender () override
 Renders the chessboard, all chess pieces, and any highlighted moves. More...
 
virtual void onKeyPressed (sf::Keyboard::Key key, bool alt, bool control, bool shift, bool system) override
 Allows the player to exit to the main menu by pressing escape. More...
 
virtual void onMouseMoved (int x, int y) override
 Updates which highlighted moves are visible. More...
 
virtual void onLButtonPressed (int x, int y) override
 Currently does nothing. More...
 
virtual void onLButtonReleased (int x, int y) override
 Selects or deselects pieces, or moves a selected piece to the clicked position. More...
 
- Public Member Functions inherited from chesspp::app::AppState
 AppState (sf::RenderWindow &disp)
 Construct bound to an sf::RenderWindow. More...
 
- Public Member Functions inherited from chesspp::SfmlEventHandler
virtual void onClosed ()
 
virtual void onResized (uint w, uint h)
 
virtual void onLostFocus ()
 
virtual void onGainedFocus ()
 
virtual void onTextEntered (sf::Uint32 unicode)
 
virtual void onKeyReleased (sf::Keyboard::Key key, bool alt, bool control, bool shift, bool system)
 
virtual void onMouseWheelMoved (int delta, int x, int y)
 
virtual void onRButtonPressed (int x, int y)
 
virtual void onRButtonReleased (int x, int y)
 
virtual void onMButtonPressed (int x, int y)
 
virtual void onMButtonReleased (int x, int y)
 
virtual void onMouseButtonPressed (sf::Mouse::Button button, int x, int y)
 
virtual void onMouseButtonReleased (sf::Mouse::Button button, int x, int y)
 
virtual void onMouseEnteredWindow ()
 
virtual void onMouseLeftWindow ()
 
virtual void onJoystickButtonPressed (uint joystickID, uint button)
 
virtual void onJoystickButtonReleased (uint joystickID, uint button)
 
virtual void onJoystickMoved (uint joystickID, sf::Joystick::Axis axis, float position)
 
virtual void onJoystickConnected (uint joystickID)
 
virtual void onJoystickDisconnected (uint joystickID)
 
virtual ~SfmlEventHandler ()=default
 

Additional Inherited Members

- Public Types inherited from chesspp::SfmlEventHandler
using uint = unsigned int
 
- Protected Attributes inherited from chesspp::app::AppState
sf::RenderWindow & display
 The sf::RenderWindow bound at construction. More...
 

Detailed Description

The AppState class for the state of the chess gameplay.

This class handles user-interaction by manipulating the chesspp::board::Board directly.

Constructor & Destructor Documentation

chesspp::app::ChessPlusPlusState::ChessPlusPlusState ( Application app,
sf::RenderWindow &  display 
)

Construct from the Application and sf::RenderWindow to be used.

Parameters
appThe Application owning this instance, must outlive this instance.
displayThe sf::RenderWindow use during onRender(), must outlive this instance.

Member Function Documentation

void chesspp::app::ChessPlusPlusState::onKeyPressed ( sf::Keyboard::Key  key,
bool  alt,
bool  control,
bool  shift,
bool  system 
)
overridevirtual

Allows the player to exit to the main menu by pressing escape.

Reimplemented from chesspp::SfmlEventHandler.

void chesspp::app::ChessPlusPlusState::onLButtonPressed ( int  x,
int  y 
)
overridevirtual

Currently does nothing.

Reimplemented from chesspp::SfmlEventHandler.

void chesspp::app::ChessPlusPlusState::onLButtonReleased ( int  x,
int  y 
)
overridevirtual

Selects or deselects pieces, or moves a selected piece to the clicked position.

Reimplemented from chesspp::SfmlEventHandler.

void chesspp::app::ChessPlusPlusState::onMouseMoved ( int  x,
int  y 
)
overridevirtual

Updates which highlighted moves are visible.

Reimplemented from chesspp::SfmlEventHandler.

void chesspp::app::ChessPlusPlusState::onRender ( )
overridevirtual

Renders the chessboard, all chess pieces, and any highlighted moves.

Implements chesspp::app::AppState.


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