00001 /* 00008 * LEGAL: COPYRIGHT (C) 2004 JIM E. BROOKS 00009 * THIS SOURCE CODE IS RELEASED UNDER THE TERMS 00010 * OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2). 00011 *****************************************************************************/ 00012 00013 #ifndef INP_QUEUE_HH 00014 #define INP_QUEUE_HH 1 00015 00016 namespace inp { 00017 00076 class InputQueue 00077 { 00078 00079 private: 00080 #if ! defined(__GNUC__) || GCC_VERSION >= 40000 00081 friend class Global; // InputQueue should be instantiated once as a Global member 00082 #endif 00083 InputQueue( void ); 00084 ~InputQueue(); 00085 00086 // Interface for application: 00087 public: 00088 void Enable( const bool enableJoystick ); // activate InputQueue (initially disabled) 00089 uint KeyQueueCnt( void ); // amount of events in queue 00090 uint JoyQueueCnt( void ); 00091 bool DequeueKeyEvent( Keyboard::Event& event/*OUT*/ ); 00092 bool DequeueJoyEvent( Joystick::Event& event/*OUT*/ ); 00093 void Flush( void ); // flush all queues 00094 void Tick( void ); // pulses InputQueue 00095 bool IfEnabled( void ) { return mEnabled; } 00096 00097 // Interface for Keyboard/Joystick classes: 00098 public: 00099 void EnqueueKeyEvent( const Keyboard::Event& event ); 00100 void EnqueueJoyEvent( const Joystick::Event& event ); 00101 00102 private: 00103 // queue<> unsuitable since it lacks erase()/clear() for flushing. 00104 bool mEnabled; 00105 deque<Keyboard::Event> mKeyQueue; 00106 deque<Joystick::Event> mJoyQueue; 00107 }; 00108 00109 } // namespace inp 00110 00111 #endif // INP_QUEUE_HH
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:11 2007