PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/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/*
  2The zlib/libpng License
  3
  4Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
  5
  6This software is provided 'as-is', without any express or implied warranty. In no event will
  7the authors be held liable for any damages arising from the use of this software.
  8
  9Permission is granted to anyone to use this software for any purpose, including commercial 
 10applications, and to alter it and redistribute it freely, subject to the following
 11restrictions:
 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
 30namespace 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			Note: If the device does not support master gain setting, nothing is done
 47		@param level
 48			A value between 0.0 and 1.0 represent the percentage of gain. 1.0
 49			being the highest possible force level (means no scaling).
 50		*/
 51		virtual void setMasterGain( float level ) = 0;
 52		
 53		/**
 54		@remarks
 55			If using Force Feedback effects, this should be turned off
 56			before uploading any effects. Auto centering is the motor moving
 57			the joystick back to center. DirectInput only has an on/off setting,
 58			whereas linux has levels.. Though, we go with DI's on/off mode only
 59			Note: If the device does not support auto-centering, nothing is done
 60		@param auto_on
 61			true to turn auto centering on, false to turn off.
 62		*/
 63		virtual void setAutoCenterMode( bool auto_on ) = 0;
 64
 65		/**
 66		@remarks
 67			Creates and Plays the effect immediately. If the device is full
 68			of effects, it will fail to be uploaded. You will know this by
 69			an invalid Effect Handle
 70		*/
 71		virtual void upload( const Effect* effect ) = 0;
 72
 73		/**
 74		@remarks
 75			Modifies an effect that is currently playing
 76		*/
 77		virtual void modify( const Effect* effect ) = 0;
 78
 79		/**
 80		@remarks
 81			Remove the effect from the device
 82		*/
 83		virtual void remove( const Effect* effect ) = 0;
 84
 85		/**
 86		@remarks
 87			Get the number of supported Axes for FF usage
 88		*/
 89        virtual short getFFAxesNumber() = 0;
 90
 91		/**
 92		@remarks
 93			Get the current load (%, in [0, 100] of the FF device memory 
 94		*/
 95		virtual unsigned short getFFMemoryLoad() = 0;
 96
 97		typedef std::multimap<Effect::EForce, Effect::EType> SupportedEffectList;
 98		/**
 99		@remarks
100			Get a list of all supported effects
101		*/
102		const SupportedEffectList& getSupportedEffects() const;
103
104		/**
105		@remarks
106			Tell if a given force / effect type pair is supported
107		*/
108		bool supportsEffect(Effect::EForce force, Effect::EType type) const;
109
110		void _addEffectTypes( Effect::EForce force, Effect::EType type );
111		void _setGainSupport( bool on );
112		void _setAutoCenterSupport( bool on );
113
114	protected:
115		SupportedEffectList mSupportedEffects;
116		bool mSetGainSupport;
117		bool mSetAutoCenterSupport;
118	};
119}
120#endif //OIS_ForceFeedBack_H