/src/ois/includes/linux/LinuxPrereqs.h

https://bitbucket.org/cabalistic/ogredeps/ · C Header · 82 lines · 39 code · 9 blank · 34 comment · 0 complexity · ac1951d0198bd6c9904884abe95ffec2 MD5 · raw file

  1. /*
  2. The zlib/libpng License
  3. Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
  4. This software is provided 'as-is', without any express or implied warranty. In no event will
  5. the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose, including commercial
  7. applications, and to alter it and redistribute it freely, subject to the following
  8. restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not claim that
  10. you wrote the original software. If you use this software in a product,
  11. an acknowledgment in the product documentation would be appreciated but is
  12. not required.
  13. 2. Altered source versions must be plainly marked as such, and must not be
  14. misrepresented as being the original software.
  15. 3. This notice may not be removed or altered from any source distribution.
  16. */
  17. #ifndef _LINUX_INPUTSYSTEM_PREREQS_H
  18. #define _LINUX_INPUTSYSTEM_PREREQS_H
  19. //Bring in any auto generated config files
  20. #ifdef HAVE_CONFIG_H
  21. # include "config.h"
  22. #endif
  23. #include "OISPrereqs.h"
  24. //! Max number of elements to collect from buffered input
  25. #define JOY_BUFFERSIZE 64
  26. namespace OIS
  27. {
  28. class LinuxInputManager;
  29. class LinuxKeyboard;
  30. class LinuxJoyStick;
  31. class LinuxMouse;
  32. class LinuxForceFeedback;
  33. class Range
  34. {
  35. public:
  36. Range() {};
  37. Range(int _min, int _max) : min(_min), max(_max) {};
  38. int min, max;
  39. };
  40. class JoyStickInfo
  41. {
  42. public:
  43. JoyStickInfo(): devId(-1),joyFileD(-1),version(0),axes(0),buttons(0),hats(0) {}
  44. //! Device number (/dev/input/j#) or /dev/input/event#
  45. int devId;
  46. //! File descriptor
  47. int joyFileD;
  48. //! Driver version
  49. int version;
  50. //! Joy vendor
  51. std::string vendor;
  52. //! Number of axes
  53. unsigned char axes;
  54. //! Number of buttons
  55. unsigned char buttons;
  56. //! Number of hats
  57. unsigned char hats;
  58. //! Maps Linux button values to OIS buttons values
  59. std::map<int, int> button_map;
  60. //! Maps Linux axis values to OIS axis
  61. std::map<int, int> axis_map;
  62. //! Maps OIS axis values to it's range
  63. std::map<int, Range> axis_range;
  64. };
  65. typedef std::vector< JoyStickInfo > JoyStickInfoList;
  66. }
  67. #endif //_LINUX_INPUTSYSTEM_PREREQS_H