[1505] | 1 | /* |
---|
| 2 | The zlib/libpng License |
---|
| 3 | |
---|
| 4 | Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com) |
---|
| 5 | |
---|
| 6 | This software is provided 'as-is', without any express or implied warranty. In no event will |
---|
| 7 | the authors be held liable for any damages arising from the use of this software. |
---|
| 8 | |
---|
| 9 | Permission is granted to anyone to use this software for any purpose, including commercial |
---|
| 10 | applications, and to alter it and redistribute it freely, subject to the following |
---|
| 11 | restrictions: |
---|
| 12 | |
---|
| 13 | 1. The origin of this software must not be misrepresented; you must not claim that |
---|
| 14 | you wrote the original software. If you use this software in a product, |
---|
| 15 | an acknowledgment in the product documentation would be appreciated but is |
---|
| 16 | not required. |
---|
| 17 | |
---|
| 18 | 2. Altered source versions must be plainly marked as such, and must not be |
---|
| 19 | misrepresented as being the original software. |
---|
| 20 | |
---|
| 21 | 3. This notice may not be removed or altered from any source distribution. |
---|
| 22 | */ |
---|
| 23 | #ifndef OIS_ForceFeedBack_H |
---|
| 24 | #define OIS_ForceFeedBack_H |
---|
| 25 | |
---|
| 26 | #include "OISPrereqs.h" |
---|
| 27 | #include "OISInterface.h" |
---|
| 28 | #include "OISEffect.h" |
---|
| 29 | |
---|
| 30 | namespace OIS |
---|
| 31 | { |
---|
| 32 | /** |
---|
| 33 | Interface class for dealing with Force Feedback devices |
---|
| 34 | */ |
---|
| 35 | class _OISExport ForceFeedback : public Interface |
---|
| 36 | { |
---|
| 37 | public: |
---|
| 38 | ForceFeedback() {} |
---|
| 39 | virtual ~ForceFeedback() {} |
---|
| 40 | |
---|
| 41 | /** |
---|
| 42 | @remarks |
---|
| 43 | This is like setting the master volume of an audio device. |
---|
| 44 | Individual effects have gain levels; however, this affects all |
---|
| 45 | effects at once. |
---|
| 46 | @param level |
---|
| 47 | A value between 0.0 and 1.0 represent the percentage of gain. 1.0 |
---|
| 48 | being the highest possible force level (means no scaling). |
---|
| 49 | */ |
---|
| 50 | virtual void setMasterGain( float level ) = 0; |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | @remarks |
---|
| 54 | If using Force Feedback effects, this should be turned off |
---|
| 55 | before uploading any effects. Auto centering is the motor moving |
---|
| 56 | the joystick back to center. DirectInput only has an on/off setting, |
---|
| 57 | whereas linux has levels.. Though, we go with DI's on/off mode only |
---|
| 58 | @param auto_on |
---|
| 59 | true to turn auto centering on, false to turn off. |
---|
| 60 | */ |
---|
| 61 | virtual void setAutoCenterMode( bool auto_on ) = 0; |
---|
| 62 | |
---|
| 63 | /** |
---|
| 64 | @remarks |
---|
| 65 | Creates and Plays the effect immediately. If the device is full |
---|
| 66 | of effects, it will fail to be uploaded. You will know this by |
---|
| 67 | an invalid Effect Handle |
---|
| 68 | */ |
---|
| 69 | virtual void upload( const Effect* effect ) = 0; |
---|
| 70 | |
---|
| 71 | /** |
---|
| 72 | @remarks |
---|
| 73 | Modifies an effect that is currently playing |
---|
| 74 | */ |
---|
| 75 | virtual void modify( const Effect* effect ) = 0; |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | @remarks |
---|
| 79 | Remove the effect from the device |
---|
| 80 | */ |
---|
| 81 | virtual void remove( const Effect* effect ) = 0; |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | @remarks |
---|
| 85 | Get the number of supported Axes for FF usage |
---|
| 86 | */ |
---|
| 87 | virtual short getFFAxesNumber() = 0; |
---|
| 88 | |
---|
| 89 | typedef std::map<Effect::EForce, Effect::EType> SupportedEffectList; |
---|
| 90 | /** |
---|
| 91 | @remarks |
---|
| 92 | Get a list of all supported effects |
---|
| 93 | */ |
---|
| 94 | const SupportedEffectList& getSupportedEffects() const; |
---|
| 95 | |
---|
| 96 | void _addEffectTypes( Effect::EForce force, Effect::EType type ); |
---|
| 97 | |
---|
| 98 | protected: |
---|
| 99 | SupportedEffectList mSupportedEffects; |
---|
| 100 | }; |
---|
| 101 | } |
---|
| 102 | #endif //OIS_ForceFeedBack_H |
---|