1 /*************************************************************************** 2 input.h - description 3 ------------------- 4 begin : Jun 13 2007 5 copyright : (C) 2007 by Giuseppe D'Aqui' 6 email : kumber@tiscalinet.it 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License, Version 2, * 13 * as published by the Free Software Foundation. * 14 * * 15 ***************************************************************************/ 16 17 #ifndef INPUT_H_ 18 #define INPUT_H_ 19 #include <SDL/SDL.h> 20 class Input 21 { 22 private: 23 // states 24 bool m_left; 25 bool m_right; 26 bool m_up; 27 bool m_down; 28 bool m_alt; 29 bool m_quit; 30 bool m_die; 31 bool m_fire; 32 bool m_pause; 33 bool m_enter; 34 bool m_fullscreen; 35 36 public: 37 38 int event_filter(const SDL_Event *event); get_left()39 bool get_left(){return m_left;} get_right()40 bool get_right(){return m_right;} get_up()41 bool get_up(){return m_up;} get_down()42 bool get_down(){return m_down;} get_quit()43 bool get_quit(){return m_quit;} get_die()44 bool get_die(){return m_die;} get_fire()45 bool get_fire(){return m_fire;} get_pause()46 bool get_pause(){return m_pause;} get_enter()47 bool get_enter(){return m_enter;} 48 void update(); 49 void init(); 50 51 void reset_states(); 52 53 // begin Singleton stuff 54 55 private: 56 57 static Input* _instance; 58 59 protected: 60 Input()61 Input(){}; 62 63 public: 64 65 static Input* instance(); 66 67 // end Singleton stuff 68 69 }; 70 #endif /*INPUT_H_*/ 71