Open main menu

CDOT Wiki β

Changes

User:Satijas

1,688 bytes added, 13:36, 7 April 2011
no edit summary
In UserDialog.cpp:
In the saveUserChoices function, add another boolcalled ff:
<big>
bool y, z, <b>ff</b>, none;
</big>
Add this line after the y and z are retrieved
<big>
ff = SendDlgItemMessage(hwnd, IDC_NOFF, BM_GETCHECK, 0, 0) != BST_CHECKED;
</big>
Add this in the else statement after y = z = false;
<big>
ff = true;
</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;
virtual void setForceTime(double) = 0;
virtual double getForceTime() = 0;
virtual void setForceDir(int) = 0;
virtual int getForceDir() = 0;
virtual void setForceFactor(float) = 0;
virtual float getForceFactor() = 0;
</big>
 
in Design.h, add these to the Design class:
<big>
private:
float fFactor;
double fTime;
int fDirection;
 
public:
bool sendForce(bool);
void setForceTime(double);
double getForceTime();
void setForceDir(int);
int getForceDir();
void setForceFactor(float);
float getForceFactor();
</big>
 
In Design.cpp constructor, add these default values:
<big>
fTime = 0.1;
fFactor = 1.0f;
fDirection = 45;
</big>
 
<big>
fTime = 0.1;
fFactor = 1.0f;
fDirection = 45;
</big>
 
<big>
bool Design::sendForce(bool force)
{
return force;
}
 
void Design::setForceTime(double time)
{
fTime = time;
}
 
double Design::getForceTime()
{
if(fTime != 0.0)
return fTime;
}
 
void Design::setForceDir(int fctr)
{
fDirection = fctr;
}
 
int Design::getForceDir()
{
return fDirection;
}
 
void Design::setForceFactor(float)
{
fFactor = 1.0f;
}
 
float Design::getForceFactor()
{
return fFactor;
}
</big>
[[Category:force feedback]]
1
edit