InputAndJoy.h 745 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef INPUTANDJOY_H_INCLUDED
  2. #define INPUTANDJOY_H_INCLUDED
  3. //Jovian
  4. /* InputAndJoy :
  5. * Last modification : 3rd August 2017
  6. * Allow several game-pads
  7. */
  8. // Includes
  9. #include <SDL2/SDL.h>
  10. #include <iostream>
  11. #include <vector>
  12. #include "Input.h"
  13. // Data
  14. struct GamePadData;
  15. // Class
  16. class InputAndJoy : public Input {
  17. public:
  18. InputAndJoy();
  19. virtual ~InputAndJoy();
  20. virtual void updateEvents();
  21. protected:
  22. bool catchPadEvents(const SDL_Event &event);
  23. public:
  24. int getAxeValue(const Uint8 axeID, Sint32 joyID = 0) const;
  25. bool getButtonPad(const Uint8 button, Sint32 joyID = 0) const;
  26. unsigned long getNbPads() const;
  27. private:
  28. std::vector<GamePadData*> m_pad;
  29. };
  30. #endif // INPUTANDJOY_H_INCLUDED