naraku9333/ChessPlusPlus — pull request #6 by Thumperrr (2013-02-21 16:32:06+00:00)
Title: Core Application Framework Proposal

class SFMLEvent is designed to be an interface to every event possible in SFML. It takes an sf::Event object, and calls certain functions depending on what that event is. For example, sf::Event contains a left click at (100, 250). SFLMEvent calls the virtual function OnLButtonPressed(100, 250). These virtual functions are reimplemented by base classes to handle events the way they want to.

class Application is the core component of the game. It has ownership of the sf::RenderWindow object, which is passed as a pointer to all other objects that need to draw something. It contains the event loop (polls for events from display) and forwards these events to the appropriate app state. The entire framework is basically broken down into 3 functions:
* onEvent(sf::Event *Event);
* onLoop();
* onRender();

class AppStateManager centralizes application states. Application calls corresponding AppStateManager functions, and AppStateManager sends that call to the current state. (i.e. in Application::onEvent, calls AppStateManager::onEvent, which calls currentState::onEvent). Everything basically trickles down until it gets where it needs to go.

AppStateGame is a placeholder class intended to eventually be where all the game logic takes place. At the moment all it is doing is providing an outline and working as a proof of concept (there are some example event functions and cout calls).