BVB Source Codes

CRYENGINE Show IForceFeedbackSystem.h Source code

Return Download CRYENGINE: download IForceFeedbackSystem.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.  
  6.    Interface for force feedback system
  7.  
  8.    -------------------------------------------------------------------------
  9.    History:
  10.    - 18-02-2010:        Created by Benito Gangoso Rodriguez
  11.    - 24-09-2012: Modified by Dario Sancho
  12. * added support for Durango Triggers
  13.  
  14. *************************************************************************/
  15.  
  16. #pragma once
  17.  
  18. #ifndef _IFORCEFEEDBACKSYSTEM_H_
  19.         #define _IFORCEFEEDBACKSYSTEM_H_
  20.  
  21. typedef uint16 ForceFeedbackFxId;
  22. static const ForceFeedbackFxId InvalidForceFeedbackFxId = 0xFFFF;
  23. struct SFFTriggerOutputData;
  24.  
  25. struct IFFSPopulateCallBack
  26. {
  27.         virtual ~IFFSPopulateCallBack(){}
  28.         // Description:
  29.         //                      Callback function to retrieve all effects available
  30.         //                      Use it in conjunction with IForceFeedbackSystem::EnumerateEffects
  31.         // See Also:
  32.         //                      IForceFeedbackSystem::EnumerateEffects
  33.         //                      IForceFeedbackSystem::GetEffectNamesCount
  34.         // Arguments:
  35.         //     pName - Name of one of the effects retrieved
  36.         virtual void AddFFSEffectName(const char* const pName) = 0;
  37. };
  38.  
  39. struct SForceFeedbackRuntimeParams
  40. {
  41.         SForceFeedbackRuntimeParams()
  42.                 : intensity(1.0f)
  43.                 , delay(0.0f)
  44.         {
  45.  
  46.         }
  47.  
  48.         SForceFeedbackRuntimeParams(float _intensity, float _delay)
  49.                 : intensity(_intensity)
  50.                 , delay(_delay)
  51.         {
  52.  
  53.         }
  54.  
  55.         float intensity;    //Scales overall intensity of the effect (0.0f - 1.0f)
  56.         float delay;        //Start playback delay
  57. };
  58.  
  59. struct IForceFeedbackSystem
  60. {
  61.         virtual ~IForceFeedbackSystem(){}
  62.         // Description:
  63.         //                      Execute a force feedback effect by id
  64.         // See Also:
  65.         //                      IForceFeedbackSystem::GetEffectIdByName
  66.         // Arguments:
  67.         //                      id - Effect id
  68.         //                      runtimeParams - Runtime params for effect, including intensity, delay...
  69.         virtual void PlayForceFeedbackEffect(ForceFeedbackFxId id, const SForceFeedbackRuntimeParams& runtimeParams) = 0;
  70.  
  71.         // Description:
  72.         //                      Stops an specific effect by id (all running instances, if more than one)
  73.         // See Also:
  74.         //                      IForceFeedbackSystem::GetEffectIdByName
  75.         //                      IForceFeedbackSystem::StopAllEffects
  76.         // Arguments:
  77.         //     id - Effect id
  78.         virtual void StopForceFeedbackEffect(ForceFeedbackFxId id) = 0;
  79.  
  80.         // Description:
  81.         //                      Returns the internal id of the effect for a given name, if defined
  82.         //                      If not found, it will return InvalidForceFeedbackFxId
  83.         // Arguments:
  84.         //     effectName - Name of the effect
  85.         // Return Value:
  86.         //     Effect id for the given name. InvalidForceFeedbackFxId if the effect was not found
  87.         virtual ForceFeedbackFxId GetEffectIdByName(const char* effectName) const = 0;
  88.  
  89.         // Description:
  90.         //                      Stops all running effects
  91.         // See Also:
  92.         //                      IForceFeedbackSystem::StopForceFeedbackEffect
  93.         virtual void StopAllEffects() = 0;
  94.  
  95.         // Description:
  96.         //                      This function can be used to request custom frame vibration values for the frame
  97.         //                      It can be useful, if a very specific vibration pattern/rules are used
  98.         //                      This custom values will be added to any other pre-defined effect running
  99.         // Arguments:
  100.         //                      amplifierA - Vibration amount from 0.0 to 1.0 for high frequency motor
  101.         //                      amplifierB - Vibration amount from 0.0 to 1.0 for low frequency motor
  102.         virtual void AddFrameCustomForceFeedback(const float amplifierA, const float amplifierB, const float amplifierLT = 0.0f, const float amplifierRT = 0.0f) = 0;
  103.  
  104.         // Description:
  105.         //                      This function can be used to request custom vibration values for the triggers
  106.         //                      It can be useful, if a very specific vibration pattern/rules are used
  107.         //                      This custom values will be added to any other pre-defined effect running
  108.         // Arguments:
  109.         //                      leftGain - Vibration amount from 0.0 to 1.0 for left trigger motor
  110.         //                      rightGain - Vibration amount from 0.0 to 1.0 for right trigger motor
  111.         //                      leftEnvelope - Envelope value (uint16) from 0 to 2000 for left trigger motor
  112.         //                      rightEnvelope - Envelope value (uint16) from 0 to 2000 for left trigger motor
  113.         virtual void AddCustomTriggerForceFeedback(const SFFTriggerOutputData& triggersData) = 0;
  114.  
  115.         // Description:
  116.         //                      Use this function to retrieve all effects names available.
  117.         //                      pCallback will be used and invoked once for every effect available, passing its name
  118.         // See Also:
  119.         //                      IFFSPopulateCallBack::AddFFSEffectName
  120.         // Arguments:
  121.         //     pCallBack - Pointer to object which implements IFFSPopulateCallBack interace
  122.         virtual void EnumerateEffects(IFFSPopulateCallBack* pCallBack) = 0;    // intended to be used only from the editor
  123.  
  124.         // Description:
  125.         //                      Returns the number of effects available
  126.         // See Also:
  127.         //                      IFFSPopulateCallBack::AddFFSEffectName
  128.         //                      IForceFeedbackSystem::EnumerateEffects
  129.         // Return Value:
  130.         //                      Number of effects
  131.         virtual int GetEffectNamesCount() const = 0;
  132.  
  133.         // Description:
  134.         //                      Prevents force feedback effects from starting. Each with bSuppressEffects = true
  135.         //                      will increment the lock count, with false will decrement
  136.         virtual void SuppressEffects(bool bSuppressEffects) = 0;
  137. };
  138.  
  139. #endif
  140.  
downloadIForceFeedbackSystem.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top