/* $Id: input.hpp,v 1.11 2005/06/28 13:55:20 chfreund Exp $ */ #ifndef _INPUT_HPP_ #define _INPUT_HPP_ #include #include #include "global.hpp" #include "string.hpp" #include "inputhandler.hpp" class Input { public: enum KeyState {NOT_PRESSED = 0, OLD_PRESSED = 1, SAVE_PRESSED = 2, JUST_PRESSED = 3}; Input (); ~Input(); void pumpEvents(); //! Check whether key is pressed or not bool keyPressed( const int key ) { return m_kbState[key] != NOT_PRESSED; } KeyState getKeyState( const int key ) {return KeyState ( m_kbState[key] );} bool anyKeyPressed(); // String& getChatString() { return m_chatString; } void setChatMode( bool value ); void addListener( InputHandler* handler ) { m_listener.push_back( handler ); } private: /* Array of chars which represents the keyboard state; Key enums can be found in SDL/SDL_keysym.h */ char m_kbState[SDLK_LAST]; std::vector m_listener; }; #endif // _HEYBOARD_HPP_