Changes

Jump to: navigation, search

User:Satijas

377 bytes added, 14:46, 7 April 2011
no edit summary
Hi, my name is Sasha. I'm in GAM670
 
[[Category:about]]
== Force Feedback ==
Add this to '''WindowSettings.h''':
<big>
</big>
Add this in typedef enum Integerin '''Configuration.h''':
<big>
GF_CT_RMBL
</big>
In '''iInput.h, ''':<br />add line 1 in the iJoystick class<br />In '''Input.h, ''':<br />add line 2 in the Joystick class<br />In Input.h, add line 3 in the Joystick class<br />
<big>
1.
</big>
In '''Input.cpp''', add the following to the Joystick constructor
<big>
ffEffects = NULL;
DIPERIODIC dip;
DIENVELOPE die;
// if both x & y have FF, make shake come at 45 degree angle
// otherwise just shake the x axis.
dif.lpvTypeSpecificParams = &dip;
dif.dwStartDelay = 3 * DI_SECONDS; // 3 secs
dip.dwMagnitude = 3 * DI_FFNOMINALMAX / 10;
dip.lOffset = 0;
dip.dwPhase = 0;
dip.dwPeriod = DI_SECONDS / 10; // 1/10th second
die.dwSize = sizeof die;
die.dwAttackLevel = factor;
die.dwFadeTime = DI_SECONDS / 2;
HRESULT hr = joystick->CreateEffect(GUID_Square, &dif, &ffEffects, NULL);
// create a ramp force
DIRAMPFORCE dirf;
dif.lpvTypeSpecificParams = &dirf;
dif.dwStartDelay = 0.01 * DI_SECONDS;
dirf.lStart = DI_FFNOMINALMAX / 2;
dirf.lEnd = - DI_FFNOMINALMAX / 2;
die.dwSize = sizeof die;
die.dwAttackLevel = DI_FFNOMINALMAX / 50;
die.dwFadeLevel = DI_FFNOMINALMAX / 10;
die.dwFadeTime = time * DI_SECONDS / 2;
if (SUCCEEDED(joystick->CreateEffect(GUID_RampForce, &dif,
&ffEffects, NULL))){
</big>
In '''UserDialog.cpp''':
In the saveUserChoices function, add another bool called ff:
<big>
bool y, z, <b>'''ff</b>''', none;
</big>
Change the flags being set after:
<big>
flags = ((y ? 1 : 0) << 2) | ((z ? 1 : 0) << 1) <b>'''| ((ff ? 0 : 1) << 3)</b> ''' | (none ? 1 : 0);
</big>
in '''iDesign.h''', add these to the iDesign class:
<big>
virtual bool sendForce(bool) = 0;
</big>
in '''Design.h''', add these to the Design class:
<big>
private:
</big>
In '''Design.cpp ''' constructor, add these default values:
<big>
fTime = 0.1;
</big>
You can then use these in Design::update function
<big>
fTime = 0.1setForceTime(double); setForceDir(int); setForceFactor(float); fFactor = 1.0fsendForce(bool); fDirection = 45context->set(GF_CT_RMBL, int(0 or 1));
</big>
Add these functions in '''Design.cpp'''
<big>
bool Design::sendForce(bool force)
</big>
[[CategoryIn '''Engine.cpp''', add this to run method:force feedback]]<big> joystick->updateForce(design->getForceFactor(), design->getForceTime(), design->getForceDir());</big>
1
edit

Navigation menu