Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

InputQueue.h

Go to the documentation of this file.
00001 /* InputQueue - Stores a list of the most recently pressed MenuInputs for each player. */ 00002 00003 #ifndef INPUTQUEUE_H 00004 #define INPUTQUEUE_H 00005 00006 #include "GameConstantsAndTypes.h" 00007 #include "GameInput.h" 00008 #include "MenuInput.h" 00009 00010 const unsigned MAX_INPUT_QUEUE_LENGTH = 16; 00011 00012 class InputQueue 00013 { 00014 public: 00015 InputQueue(); 00016 00017 void RememberInput( GameInput ); 00018 bool MatchesSequence( GameController c, const GameButton* button_sequence, int iNumButtons, float fMaxSecondsBack ); 00019 bool MatchesSequence( GameController c, const MenuButton* button_sequence, int iNumButtons, float fMaxSecondsBack ); 00020 bool AllWerePressedRecently( GameController c, const GameButton* buttons, int iNumButtons, float fMaxSecondsBack ); 00021 00022 protected: 00023 struct GameButtonAndTime 00024 { 00025 GameButtonAndTime() {} 00026 GameButtonAndTime( GameButton b, float t ) { button = b; fTime = t; }; 00027 GameButton button; 00028 float fTime; 00029 }; 00030 vector<GameButtonAndTime> m_aQueue[MAX_GAME_CONTROLLERS]; 00031 }; 00032 00033 00034 extern InputQueue* INPUTQUEUE; // global and accessable from anywhere in our program 00035 00036 #endif 00037 00038 /* 00039 * (c) 2001-2003 Chris Danford 00040 * All rights reserved. 00041 * 00042 * Permission is hereby granted, free of charge, to any person obtaining a 00043 * copy of this software and associated documentation files (the 00044 * "Software"), to deal in the Software without restriction, including 00045 * without limitation the rights to use, copy, modify, merge, publish, 00046 * distribute, and/or sell copies of the Software, and to permit persons to 00047 * whom the Software is furnished to do so, provided that the above 00048 * copyright notice(s) and this permission notice appear in all copies of 00049 * the Software and that both the above copyright notice(s) and this 00050 * permission notice appear in supporting documentation. 00051 * 00052 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00053 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00054 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00055 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00056 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00057 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00058 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00059 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00060 * PERFORMANCE OF THIS SOFTWARE. 00061 */

Generated on Thu Jan 27 20:57:22 2005 for StepMania by doxygen 1.3.7