/src/ois/includes/OISForceFeedback.h

https://bitbucket.org/cabalistic/ogredeps/ · C Header · 120 lines · 32 code · 13 blank · 75 comment · 0 complexity · e3dd194e4570f9bccbbb8b70aebc216c 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 OIS_ForceFeedBack_H
  18. #define OIS_ForceFeedBack_H
  19. #include "OISPrereqs.h"
  20. #include "OISInterface.h"
  21. #include "OISEffect.h"
  22. namespace OIS
  23. {
  24. /**
  25. Interface class for dealing with Force Feedback devices
  26. */
  27. class _OISExport ForceFeedback : public Interface
  28. {
  29. public:
  30. ForceFeedback();
  31. virtual ~ForceFeedback() {}
  32. /**
  33. @remarks
  34. This is like setting the master volume of an audio device.
  35. Individual effects have gain levels; however, this affects all
  36. effects at once.
  37. Note: If the device does not support master gain setting, nothing is done
  38. @param level
  39. A value between 0.0 and 1.0 represent the percentage of gain. 1.0
  40. being the highest possible force level (means no scaling).
  41. */
  42. virtual void setMasterGain( float level ) = 0;
  43. /**
  44. @remarks
  45. If using Force Feedback effects, this should be turned off
  46. before uploading any effects. Auto centering is the motor moving
  47. the joystick back to center. DirectInput only has an on/off setting,
  48. whereas linux has levels.. Though, we go with DI's on/off mode only
  49. Note: If the device does not support auto-centering, nothing is done
  50. @param auto_on
  51. true to turn auto centering on, false to turn off.
  52. */
  53. virtual void setAutoCenterMode( bool auto_on ) = 0;
  54. /**
  55. @remarks
  56. Creates and Plays the effect immediately. If the device is full
  57. of effects, it will fail to be uploaded. You will know this by
  58. an invalid Effect Handle
  59. */
  60. virtual void upload( const Effect* effect ) = 0;
  61. /**
  62. @remarks
  63. Modifies an effect that is currently playing
  64. */
  65. virtual void modify( const Effect* effect ) = 0;
  66. /**
  67. @remarks
  68. Remove the effect from the device
  69. */
  70. virtual void remove( const Effect* effect ) = 0;
  71. /**
  72. @remarks
  73. Get the number of supported Axes for FF usage
  74. */
  75. virtual short getFFAxesNumber() = 0;
  76. /**
  77. @remarks
  78. Get the current load (%, in [0, 100] of the FF device memory
  79. */
  80. virtual unsigned short getFFMemoryLoad() = 0;
  81. typedef std::multimap<Effect::EForce, Effect::EType> SupportedEffectList;
  82. /**
  83. @remarks
  84. Get a list of all supported effects
  85. */
  86. const SupportedEffectList& getSupportedEffects() const;
  87. /**
  88. @remarks
  89. Tell if a given force / effect type pair is supported
  90. */
  91. bool supportsEffect(Effect::EForce force, Effect::EType type) const;
  92. void _addEffectTypes( Effect::EForce force, Effect::EType type );
  93. void _setGainSupport( bool on );
  94. void _setAutoCenterSupport( bool on );
  95. protected:
  96. SupportedEffectList mSupportedEffects;
  97. bool mSetGainSupport;
  98. bool mSetAutoCenterSupport;
  99. };
  100. }
  101. #endif //OIS_ForceFeedBack_H