#include <GameState.h>

Public Types | |
| enum | MouseButton { MouseButtonLeft = 0x1, MouseButtonMiddle = 0x2, MouseButtonRight = 0x4, MouseButtonLeftDoubleClick = 0x8, MouseButtonMiddleDoubleClick = 0x16, MouseButtonRightDoubleClick = 0x32 } |
Public Member Functions | |
| GameState (const char *name) | |
| virtual | ~GameState () |
| virtual void | simulate (float simTime) |
| virtual void | draw () |
| bool | checkStimulate () |
| void | clear () |
| void | mouseDown (MouseButton button, int x, int y) |
| void | mouseUp (MouseButton button, int x, int y) |
| void | mouseMove (int x, int y) |
| void | mouseWheel (short z) |
| void | setState (const unsigned state) |
| void | stimulate (const unsigned stimulus) |
| void | setFakeMiddleButton (bool fake) |
| const unsigned | getState () |
| int | getMouseX () |
| int | getMouseY () |
| bool & | getStateLogging () |
| float & | getStateTimeLogging () |
| int | getPerfCounter (const char *name) |
| void | startPerfCount (int counter) |
| void | endPerfCount (int counter) |
| void | addStateStimulus (const unsigned state, const unsigned stim, const unsigned nexts) |
| void | addStateStimulus (const unsigned state, GameStateStimulusI *check, const unsigned nexts) |
| void | addStateEntry (const unsigned state, GameStateI *entry) |
| void | addStateLoop (const unsigned state, GameStateI *entry, GameStateI *subEntry) |
| void | addStateKeyEntry (const unsigned state, GameStateI *subEntry) |
| void | addStateMouseDownEntry (const unsigned state, const unsigned buttons, GameStateI *subEntry) |
| void | addStateMouseUpEntry (const unsigned state, const unsigned buttons, GameStateI *subEntry) |
| void | addStateMouseDragEntry (const unsigned state, const unsigned buttons, GameStateI *subEntry) |
| void | addStateMouseWheelEntry (const unsigned state, GameStateI *subEntry) |
Protected Types | |
| typedef std::list < GameStateI * > | StateIList |
| typedef std::pair < GameStateStimulusI *, unsigned > | SimulusIPair |
| typedef std::list < SimulusIPair > | StiulusIList |
Protected Member Functions | |
| void | mouseMoveCall (const unsigned state, MouseButton button, StateIList ¤tList, int mx, int my, int dx, int dy) |
| void | mouseUpDown (MouseButton button, bool down, int x, int y) |
| GameState::GameStateEntry * | getEntry (const unsigned state) |
| GameState::GameStateSubEntry * | getSubEntry (const unsigned state, GameStateI *entry) |
| void | clearTimers (bool printTimers=false) |
Protected Attributes | |
| unsigned | currentState_ |
| GameStateI * | currentStateI_ |
| GameStateEntry * | currentEntry_ |
| std::map< unsigned, GameStateEntry > | stateList_ |
| std::string | name_ |
| unsigned | pendingStimulus_ |
| bool | fakeMiddleButton_ |
| bool | stateLogging_ |
| float | stateTimeLogging_ |
| int | frameCount_ |
| Clock | timerClock_ |
| Clock | overallTimerClock_ |
| Clock | doubleClickClock_ |
| TimerInfo | timers_ [50] |
| unsigned | currentMouseState_ |
| int | mouseLDragX_ |
| int | mouseLDragY_ |
| int | mouseMDragX_ |
| int | mouseMDragY_ |
| int | mouseRDragX_ |
| int | mouseRDragY_ |
| int | mouseDoubleX_ |
| int | mouseDoubleY_ |
| int | currentMouseX_ |
| int | currentMouseY_ |
Classes | |
| struct | GameStateEntry |
| struct | GameStateSubEntry |
| struct | TimerInfo |
Definition at line 57 of file GameState.h.
typedef std::list<GameStateI *> GameState::StateIList [protected] |
Definition at line 127 of file GameState.h.
typedef std::pair<GameStateStimulusI *, unsigned> GameState::SimulusIPair [protected] |
Definition at line 128 of file GameState.h.
typedef std::list<SimulusIPair> GameState::StiulusIList [protected] |
Definition at line 129 of file GameState.h.
| MouseButtonLeft | |
| MouseButtonMiddle | |
| MouseButtonRight | |
| MouseButtonLeftDoubleClick | |
| MouseButtonMiddleDoubleClick | |
| MouseButtonRightDoubleClick |
Definition at line 60 of file GameState.h.
| GameState::GameState | ( | const char * | name | ) |
| GameState::~GameState | ( | ) | [virtual] |
Definition at line 77 of file GameState.cpp.
| void GameState::simulate | ( | float | simTime | ) | [virtual] |
Reimplemented from MainLoopI.
Definition at line 312 of file GameState.cpp.
References checkStimulate(), clearTimers(), GameState::GameStateEntry::condStimList, currentEntry_, currentState_, currentStateI_, S3D::formatStringBuffer(), frameCount_, GameState::TimerInfo::gameStateI, Keyboard::getkeyboardbuffer(), Keyboard::getkeyboardhistory(), Keyboard::getKeyboardState(), Clock::getTicksDifference(), Keyboard::instance(), Logger::log(), GameState::GameStateEntry::loopList, name_, setState(), GameStateI::simulate(), GameState::TimerInfo::simulateTime, stateLogging_, stateTimeLogging_, GameState::GameStateEntry::subKeyList, timerClock_, and timers_.
Referenced by serverLoop().
| void GameState::draw | ( | ) | [virtual] |
Reimplemented from MainLoopI.
Definition at line 401 of file GameState.cpp.
References checkStimulate(), currentEntry_, currentState_, currentStateI_, GameStateI::draw(), GameState::TimerInfo::drawTime, frameCount_, GameState::TimerInfo::gameStateI, Clock::getTicksDifference(), GameState::GameStateEntry::loopList, timerClock_, and timers_.
Referenced by serverLoop().
| bool GameState::checkStimulate | ( | ) |
Definition at line 486 of file GameState.cpp.
References currentEntry_, currentState_, S3D::dialogExit(), S3D::formatStringBuffer(), name_, pendingStimulus_, setState(), and GameState::GameStateEntry::stimList.
Referenced by ClientNewGameHandler::actualProcessMessage(), ClientMessageHandler::clientDisconnected(), draw(), ClientInitializeHandler::initialize(), mouseMoveCall(), mouseUpDown(), mouseWheel(), ClientStartGameHandler::processMessage(), ClientShotState::processMessage(), ClientScoreHandler::processMessage(), setState(), and simulate().
| void GameState::clear | ( | ) |
Definition at line 82 of file GameState.cpp.
References stateList_.
Referenced by ClientState::setupGameState(), and ServerState::setupStates().
| void GameState::mouseDown | ( | MouseButton | button, | |
| int | x, | |||
| int | y | |||
| ) |
Definition at line 191 of file GameState.cpp.
References doubleClickClock_, Clock::getTimeDifference(), MouseButtonLeft, MouseButtonLeftDoubleClick, MouseButtonMiddle, MouseButtonMiddleDoubleClick, MouseButtonRight, MouseButtonRightDoubleClick, mouseDoubleX_, mouseDoubleY_, and mouseUpDown().
| void GameState::mouseUp | ( | MouseButton | button, | |
| int | x, | |||
| int | y | |||
| ) |
| void GameState::mouseMove | ( | int | x, | |
| int | y | |||
| ) |
Definition at line 118 of file GameState.cpp.
References currentEntry_, currentMouseState_, currentMouseX_, currentMouseY_, currentState_, fakeMiddleButton_, MouseButtonLeft, MouseButtonMiddle, MouseButtonRight, mouseLDragX_, mouseLDragY_, mouseMDragX_, mouseMDragY_, mouseMoveCall(), mouseRDragX_, mouseRDragY_, GameState::GameStateEntry::subMouseDragLeftList, GameState::GameStateEntry::subMouseDragMiddleList, and GameState::GameStateEntry::subMouseDragRightList.
| void GameState::mouseWheel | ( | short | z | ) |
Definition at line 92 of file GameState.cpp.
References checkStimulate(), currentEntry_, currentMouseX_, currentMouseY_, currentState_, and GameState::GameStateEntry::subMouseWheelList.
| void GameState::setState | ( | const unsigned | state | ) |
Definition at line 438 of file GameState.cpp.
References checkStimulate(), clearTimers(), currentEntry_, currentState_, S3D::dialogExit(), GameStateI::enterState(), GameState::GameStateEntry::enterStateList, S3D::formatStringBuffer(), Logger::log(), name_, pendingStimulus_, stateList_, and stateLogging_.
Referenced by checkStimulate(), ClientState::setupGameState(), ServerState::setupStates(), and simulate().
| void GameState::stimulate | ( | const unsigned | stimulus | ) |
Definition at line 510 of file GameState.cpp.
References S3D::formatStringBuffer(), Logger::log(), name_, pendingStimulus_, and stateLogging_.
Referenced by ServerShotFinishedState::acceptStateChange(), ClientNewGameHandler::actualProcessMessage(), BuyAccessoryDialog::buttonDown(), ClientConnectionAuthHandler::cancelAuth(), ClientMessageHandler::clientDisconnected(), ConnectDialog::connected(), ServerResetState::enterState(), ServerNextTurnState::enterState(), ServerNextShotState::enterState(), ServerNextRoundState::enterState(), ServerNewGameState::enterState(), AutoDefenseDialog::finished(), TankKeyboardControlUtil::fireShot(), initClient(), ClientInitializeHandler::initialize(), ServerAddPlayerHandler::processMessage(), ClientStartGameHandler::processMessage(), ClientShotState::processMessage(), ClientScoreHandler::processMessage(), ClientFileHandler::processMessage(), TankKeyboardControlUtil::resign(), ClientWaitState::sendClientReady(), ConnectDialog::simulate(), and TankKeyboardControlUtil::skipShot().
| void GameState::setFakeMiddleButton | ( | bool | fake | ) |
| const unsigned GameState::getState | ( | ) | [inline] |
Definition at line 90 of file GameState.h.
References currentState_.
Referenced by TankAIAdder::addTankAI(), ServerMessageHandler::destroyPlayer(), QuitDialog::display(), GLMenu::draw(), MainCamera::getEnabled(), GLMenu::mouseDown(), ServerPlayedMoveHandler::processMessage(), ServerAddPlayerHandler::processMessage(), ServerWebHandler::ServerHandler::processRequest(), ServerWebHandler::GameHandler::processRequest(), ServerBrowserInfo::processStatusMessage(), ProgressDialogSync::progressChange(), TargetRendererImplTank::render(), TargetRendererImplTank::render2D(), TankWeapon::setCurrentWeapon(), and CameraDialog::simulate().
| int GameState::getMouseX | ( | ) | [inline] |
Definition at line 91 of file GameState.h.
References currentMouseX_.
Referenced by GLWToolTip::addToolTip(), TankKeyboardControlUtil::autoAim(), GLWChannelText::buttonDown(), GLWToolTip::clearToolTip(), SoftwareMouse::draw(), GLWSelectorPart::draw(), GLWScorchedInfo::draw(), GLMenu::draw(), StartDialog::draw(), GLWWindow::drawMaximizedWindow(), and MainCamera::simulate().
| int GameState::getMouseY | ( | ) | [inline] |
Definition at line 92 of file GameState.h.
References currentMouseY_.
Referenced by GLWToolTip::addToolTip(), TankKeyboardControlUtil::autoAim(), GLWChannelText::buttonDown(), GLWToolTip::clearToolTip(), SoftwareMouse::draw(), GLWSelectorPart::draw(), GLWScorchedInfo::draw(), GLMenu::draw(), StartDialog::draw(), GLWWindow::drawMaximizedWindow(), and MainCamera::simulate().
| bool& GameState::getStateLogging | ( | ) | [inline] |
Definition at line 93 of file GameState.h.
References stateLogging_.
Referenced by TankMenus::TankMenus().
| float& GameState::getStateTimeLogging | ( | ) | [inline] |
| int GameState::getPerfCounter | ( | const char * | name | ) |
Definition at line 743 of file GameState.cpp.
References currentStateI_, DIALOG_ASSERT, and GameStateI::getPerfCounter().
| void GameState::startPerfCount | ( | int | counter | ) |
Definition at line 749 of file GameState.cpp.
References currentStateI_, DIALOG_ASSERT, and GameStateI::startPerfCount().
| void GameState::endPerfCount | ( | int | counter | ) |
Definition at line 755 of file GameState.cpp.
References currentStateI_, DIALOG_ASSERT, and GameStateI::endPerfCount().
| void GameState::addStateStimulus | ( | const unsigned | state, | |
| const unsigned | stim, | |||
| const unsigned | nexts | |||
| ) |
Definition at line 649 of file GameState.cpp.
References DIALOG_ASSERT, getEntry(), and GameState::GameStateEntry::stimList.
Referenced by ClientState::setupGameState(), and ServerState::setupStates().
| void GameState::addStateStimulus | ( | const unsigned | state, | |
| GameStateStimulusI * | check, | |||
| const unsigned | nexts | |||
| ) |
Definition at line 665 of file GameState.cpp.
References GameState::GameStateEntry::condStimList, and getEntry().
| void GameState::addStateEntry | ( | const unsigned | state, | |
| GameStateI * | entry | |||
| ) |
Definition at line 579 of file GameState.cpp.
References GameState::GameStateEntry::enterStateList, and getEntry().
Referenced by ClientState::addStandardComponents(), ClientState::addWindowManager(), ClientState::setupGameState(), and ServerState::setupStates().
| void GameState::addStateLoop | ( | const unsigned | state, | |
| GameStateI * | entry, | |||
| GameStateI * | subEntry | |||
| ) |
Definition at line 573 of file GameState.cpp.
References getSubEntry(), and GameState::GameStateSubEntry::subLoopList.
Referenced by ClientState::addMandatoryComponents(), ClientState::addStandardComponents(), ClientState::addWindowManager(), ClientState::setupGameState(), and ServerState::setupStates().
| void GameState::addStateKeyEntry | ( | const unsigned | state, | |
| GameStateI * | subEntry | |||
| ) |
Definition at line 584 of file GameState.cpp.
References getEntry(), and GameState::GameStateEntry::subKeyList.
Referenced by ClientState::addStandardComponents(), ClientState::addWindowManager(), and ClientState::setupGameState().
| void GameState::addStateMouseDownEntry | ( | const unsigned | state, | |
| const unsigned | buttons, | |||
| GameStateI * | subEntry | |||
| ) |
Definition at line 589 of file GameState.cpp.
References getEntry(), MouseButtonLeft, MouseButtonMiddle, MouseButtonRight, GameState::GameStateEntry::subMouseDownLeftList, GameState::GameStateEntry::subMouseDownMiddleList, and GameState::GameStateEntry::subMouseDownRightList.
Referenced by ClientState::addStandardComponents(), and ClientState::addWindowManager().
| void GameState::addStateMouseUpEntry | ( | const unsigned | state, | |
| const unsigned | buttons, | |||
| GameStateI * | subEntry | |||
| ) |
Definition at line 607 of file GameState.cpp.
References getEntry(), MouseButtonLeft, MouseButtonMiddle, MouseButtonRight, GameState::GameStateEntry::subMouseUpLeftList, GameState::GameStateEntry::subMouseUpMiddleList, and GameState::GameStateEntry::subMouseUpRightList.
Referenced by ClientState::addStandardComponents(), and ClientState::addWindowManager().
| void GameState::addStateMouseDragEntry | ( | const unsigned | state, | |
| const unsigned | buttons, | |||
| GameStateI * | subEntry | |||
| ) |
Definition at line 625 of file GameState.cpp.
References getEntry(), MouseButtonLeft, MouseButtonMiddle, MouseButtonRight, GameState::GameStateEntry::subMouseDragLeftList, GameState::GameStateEntry::subMouseDragMiddleList, and GameState::GameStateEntry::subMouseDragRightList.
Referenced by ClientState::addStandardComponents(), and ClientState::addWindowManager().
| void GameState::addStateMouseWheelEntry | ( | const unsigned | state, | |
| GameStateI * | subEntry | |||
| ) |
Definition at line 643 of file GameState.cpp.
References getEntry(), and GameState::GameStateEntry::subMouseWheelList.
Referenced by ClientState::addStandardComponents(), and ClientState::addWindowManager().
| void GameState::mouseMoveCall | ( | const unsigned | state, | |
| MouseButton | button, | |||
| StateIList & | currentList, | |||
| int | mx, | |||
| int | my, | |||
| int | dx, | |||
| int | dy | |||
| ) | [protected] |
Definition at line 171 of file GameState.cpp.
References checkStimulate().
Referenced by mouseMove().
| void GameState::mouseUpDown | ( | MouseButton | button, | |
| bool | down, | |||
| int | x, | |||
| int | y | |||
| ) | [protected] |
Definition at line 221 of file GameState.cpp.
References checkStimulate(), currentEntry_, currentMouseState_, currentState_, fakeMiddleButton_, MouseButtonLeft, MouseButtonLeftDoubleClick, MouseButtonMiddle, MouseButtonRight, mouseLDragX_, mouseLDragY_, mouseMDragX_, mouseMDragY_, mouseRDragX_, mouseRDragY_, GameState::GameStateEntry::subMouseDownLeftList, GameState::GameStateEntry::subMouseDownMiddleList, GameState::GameStateEntry::subMouseDownRightList, GameState::GameStateEntry::subMouseUpLeftList, GameState::GameStateEntry::subMouseUpMiddleList, and GameState::GameStateEntry::subMouseUpRightList.
Referenced by mouseDown(), and mouseUp().
| GameState::GameStateEntry * GameState::getEntry | ( | const unsigned | state | ) | [protected] |
Definition at line 520 of file GameState.cpp.
References currentEntry_, currentState_, and stateList_.
Referenced by addStateEntry(), addStateKeyEntry(), addStateMouseDownEntry(), addStateMouseDragEntry(), addStateMouseUpEntry(), addStateMouseWheelEntry(), addStateStimulus(), and getSubEntry().
| GameState::GameStateSubEntry * GameState::getSubEntry | ( | const unsigned | state, | |
| GameStateI * | entry | |||
| ) | [protected] |
Definition at line 544 of file GameState.cpp.
References GameState::GameStateSubEntry::current, getEntry(), and GameState::GameStateEntry::loopList.
Referenced by addStateLoop().
| void GameState::clearTimers | ( | bool | printTimers = false |
) | [protected] |
Definition at line 674 of file GameState.cpp.
References GameState::TimerInfo::drawTime, S3D::formatStringBuffer(), frameCount_, GameState::TimerInfo::gameStateI, GameStatePerfCounter::getName(), GameStateI::getPerfCounters(), Clock::getTicksDifference(), GameStatePerfCounter::getTotal(), GameStatePerfCounter::getUsed(), int(), Logger::log(), name_, overallTimerClock_, GameState::TimerInfo::simulateTime, stateTimeLogging_, and timers_.
Referenced by GameState(), setState(), and simulate().
unsigned GameState::currentState_ [protected] |
Definition at line 180 of file GameState.h.
Referenced by checkStimulate(), draw(), getEntry(), getState(), mouseMove(), mouseUpDown(), mouseWheel(), setState(), and simulate().
GameStateI* GameState::currentStateI_ [protected] |
Definition at line 181 of file GameState.h.
Referenced by draw(), endPerfCount(), getPerfCounter(), simulate(), and startPerfCount().
GameStateEntry* GameState::currentEntry_ [protected] |
Definition at line 182 of file GameState.h.
Referenced by checkStimulate(), draw(), getEntry(), mouseMove(), mouseUpDown(), mouseWheel(), setState(), and simulate().
std::map<unsigned, GameStateEntry> GameState::stateList_ [protected] |
std::string GameState::name_ [protected] |
Definition at line 184 of file GameState.h.
Referenced by checkStimulate(), clearTimers(), setState(), simulate(), and stimulate().
unsigned GameState::pendingStimulus_ [protected] |
Definition at line 185 of file GameState.h.
Referenced by checkStimulate(), setState(), and stimulate().
bool GameState::fakeMiddleButton_ [protected] |
Definition at line 186 of file GameState.h.
Referenced by mouseMove(), mouseUpDown(), and setFakeMiddleButton().
bool GameState::stateLogging_ [protected] |
Definition at line 187 of file GameState.h.
Referenced by getStateLogging(), setState(), simulate(), and stimulate().
float GameState::stateTimeLogging_ [protected] |
Definition at line 188 of file GameState.h.
Referenced by clearTimers(), getStateTimeLogging(), and simulate().
int GameState::frameCount_ [protected] |
Clock GameState::timerClock_ [protected] |
Clock GameState::overallTimerClock_ [protected] |
Clock GameState::doubleClickClock_ [protected] |
TimerInfo GameState::timers_[50] [protected] |
unsigned GameState::currentMouseState_ [protected] |
int GameState::mouseLDragX_ [protected] |
int GameState::mouseLDragY_ [protected] |
int GameState::mouseMDragX_ [protected] |
int GameState::mouseMDragY_ [protected] |
int GameState::mouseRDragX_ [protected] |
int GameState::mouseRDragY_ [protected] |
int GameState::mouseDoubleX_ [protected] |
int GameState::mouseDoubleY_ [protected] |
int GameState::currentMouseX_ [protected] |
Definition at line 202 of file GameState.h.
Referenced by getMouseX(), mouseMove(), and mouseWheel().
int GameState::currentMouseY_ [protected] |
Definition at line 202 of file GameState.h.
Referenced by getMouseY(), mouseMove(), and mouseWheel().
1.5.3