gxdevice.h 600 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef GXDEVICE_H
  2. #define GXDEVICE_H
  3. class gxDevice{
  4. public:
  5. float axis_states[32];
  6. gxDevice();
  7. virtual ~gxDevice();
  8. virtual void update(){}
  9. void reset();
  10. void downEvent( int key );
  11. void upEvent( int key );
  12. void setDownState( int key,bool down );
  13. private:
  14. enum{
  15. QUE_SIZE=32,QUE_MASK=QUE_SIZE-1
  16. };
  17. int hit_count[256]; //how many hits of key
  18. bool down_state[256]; //time key went down
  19. int que[QUE_SIZE],put,get;
  20. /***** GX INTERFACE *****/
  21. public:
  22. void flush();
  23. bool keyDown( int key );
  24. int keyHit( int key );
  25. int getKey();
  26. float getAxisState( int axis );
  27. };
  28. #endif