Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Ybalrid committed May 13, 2021
1 parent 37c58b1 commit 6edb487
Show file tree
Hide file tree
Showing 52 changed files with 343 additions and 353 deletions.
60 changes: 30 additions & 30 deletions demos/FFConsoleDemo/FFConsoleDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ class Variable
return oss.str();
}

virtual void update(){};
virtual void update() {};
};

class Constant : public Variable
{
public:
Constant(double dInitValue) :
Variable(dInitValue) {}
Variable(dInitValue) { }

virtual void setValue(double dValue) {}
virtual void setValue(double dValue) { }
};

class LimitedVariable : public Variable
Expand All @@ -131,7 +131,7 @@ class LimitedVariable : public Variable
public:
LimitedVariable(double dInitValue, double dMinValue, double dMaxValue) :
Variable(dInitValue), _dMinValue(dMinValue), _dMaxValue(dMaxValue)
{}
{ }

virtual void setValue(double dValue)
{
Expand All @@ -158,7 +158,7 @@ class TriangleVariable : public LimitedVariable

public:
TriangleVariable(double dInitValue, double dDeltaValue, double dMinValue, double dMaxValue) :
LimitedVariable(dInitValue, dMinValue, dMaxValue), _dDeltaValue(dDeltaValue){};
LimitedVariable(dInitValue, dMinValue, dMaxValue), _dDeltaValue(dDeltaValue) {};

virtual void update()
{
Expand Down Expand Up @@ -207,7 +207,7 @@ class VariableEffect
VariableEffect(const char* pszDesc, Effect* pEffect, const MapVariables& mapVars, const EffectVariablesApplier pfApplyVars) :
_pszDesc(pszDesc), _pEffect(pEffect),
_mapVariables(mapVars), _pfApplyVariables(pfApplyVars), _bActive(false)
{}
{ }

~VariableEffect()
{
Expand Down Expand Up @@ -459,7 +459,7 @@ void forceVariableApplier(MapVariables& mapVars, Effect* pEffect)
ConstantEffect* pConstForce = dynamic_cast<ConstantEffect*>(pEffect->getForceEffect());
pConstForce->level = (int)dForce;
pConstForce->envelope.attackLevel = (unsigned short)fabs(dForce * dAttackFactor);
pConstForce->envelope.fadeLevel = (unsigned short)fabs(dForce); // Fade never reached, in fact.
pConstForce->envelope.fadeLevel = (unsigned short)fabs(dForce); // Fade never reached, in fact.
}

// Variable "Period" on an OIS::PeriodicEffect
Expand Down Expand Up @@ -535,17 +535,17 @@ class EffectManager
// Linux2.6.22.9=Not supported
pEffect = new Effect(Effect::ConstantForce, Effect::Constant);
pEffect->direction = Effect::North;
pEffect->trigger_button = 0;
pEffect->trigger_button = 0;
pEffect->trigger_interval = 0;
pEffect->replay_length = Effect::OIS_INFINITE; // Linux/Win32: Same behaviour as 0.
pEffect->replay_delay = 0;
pEffect->replay_length = Effect::OIS_INFINITE; // Linux/Win32: Same behaviour as 0.
pEffect->replay_delay = 0;
pEffect->setNumAxes(1);
pConstForce = dynamic_cast<ConstantEffect*>(pEffect->getForceEffect());
pConstForce->level = 5000; //-10K to +10k
pConstForce->envelope.attackLength = 0;
pConstForce->envelope.attackLevel = (unsigned short)pConstForce->level;
pConstForce->envelope.fadeLength = 0;
pConstForce->envelope.fadeLevel = (unsigned short)pConstForce->level;
pConstForce->envelope.fadeLevel = (unsigned short)pConstForce->level;

mapVars.clear();
mapVars["Force"] = new TriangleVariable(0.0, // F0
Expand All @@ -568,17 +568,17 @@ class EffectManager
// Linux2.6.22.9=Not supported.
pEffect = new Effect(Effect::ConstantForce, Effect::Constant);
pEffect->direction = Effect::North;
pEffect->trigger_button = 0;
pEffect->trigger_button = 0;
pEffect->trigger_interval = 0;
pEffect->replay_length = Effect::OIS_INFINITE; //(unsigned int)(1000000.0/_nUpdateFreq); // Linux: Does not work.
pEffect->replay_delay = 0;
pEffect->replay_length = Effect::OIS_INFINITE; //(unsigned int)(1000000.0/_nUpdateFreq); // Linux: Does not work.
pEffect->replay_delay = 0;
pEffect->setNumAxes(1);
pConstForce = dynamic_cast<ConstantEffect*>(pEffect->getForceEffect());
pConstForce->level = 5000; //-10K to +10k
pConstForce->envelope.attackLength = (unsigned int)(1000000.0 / _nUpdateFreq / 2);
pConstForce->envelope.attackLevel = (unsigned short)(pConstForce->level * 0.1);
pConstForce->envelope.fadeLength = 0; // Never reached, actually.
pConstForce->envelope.fadeLevel = (unsigned short)pConstForce->level; // Idem
pConstForce->envelope.fadeLevel = (unsigned short)pConstForce->level; // Idem

mapVars.clear();
mapVars["Force"] = new TriangleVariable(0.0, // F0
Expand All @@ -601,19 +601,19 @@ class EffectManager
// Linux2.6.22.9=Failed.
pEffect = new Effect(Effect::PeriodicForce, Effect::Triangle);
pEffect->direction = Effect::North;
pEffect->trigger_button = 0;
pEffect->trigger_button = 0;
pEffect->trigger_interval = 0;
pEffect->replay_length = Effect::OIS_INFINITE;
pEffect->replay_delay = 0;
pEffect->replay_length = Effect::OIS_INFINITE;
pEffect->replay_delay = 0;
pEffect->setNumAxes(1);
pPeriodForce = dynamic_cast<PeriodicEffect*>(pEffect->getForceEffect());
pPeriodForce->magnitude = 10000; // 0 to +10k
pPeriodForce->offset = 0;
pPeriodForce->phase = 0; // 0 to 35599
pPeriodForce->period = 10000; // Micro-seconds
pPeriodForce->envelope.attackLength = 0;
pPeriodForce->envelope.attackLevel = (unsigned short)pPeriodForce->magnitude;
pPeriodForce->envelope.fadeLength = 0;
pPeriodForce->envelope.attackLevel = (unsigned short)pPeriodForce->magnitude;
pPeriodForce->envelope.fadeLength = 0;
pPeriodForce->envelope.fadeLevel = (unsigned short)pPeriodForce->magnitude;

mapVars.clear();
Expand Down Expand Up @@ -657,7 +657,7 @@ class EffectManager
for(size_t nEffInd = 0; nEffInd < _vecEffects.size(); nEffInd++)
{
const Effect::EForce eForce = _vecEffects[nEffInd]->getFFEffect()->force;
const Effect::EType eType = _vecEffects[nEffInd]->getFFEffect()->type;
const Effect::EType eType = _vecEffects[nEffInd]->getFFEffect()->type;
if(_pJoystickMgr->getCurrentFFDevice()->supportsEffect(eForce, eType))
{
_vecPlayableEffectInd.push_back(nEffInd);
Expand All @@ -683,8 +683,8 @@ class EffectManager
}

enum EWhichEffect { ePrevious = -1,
eNone = 0,
eNext = +1 };
eNone = 0,
eNext = +1 };

void selectEffect(EWhichEffect eWhich)
{
Expand Down Expand Up @@ -799,17 +799,17 @@ class Application
public:
Application(int argc, const char* argv[])
{
_pInputMgr = nullptr;
_pEventHdlr = nullptr;
_pKeyboard = nullptr;
_pInputMgr = nullptr;
_pEventHdlr = nullptr;
_pKeyboard = nullptr;
_pJoystickMgr = nullptr;
_pEffectMgr = nullptr;
_pEffectMgr = nullptr;

#if defined OIS_WIN32_PLATFORM
_hWnd = nullptr;
#elif defined OIS_LINUX_PLATFORM
_pXDisp = 0;
_xWin = 0;
_xWin = 0;
#endif

_bMustStop = false;
Expand Down Expand Up @@ -1048,12 +1048,12 @@ class Application

EventHandler::EventHandler(Application* pApp) :
_pApplication(pApp)
{}
{ }

void EventHandler::initialize(JoystickManager* pJoystickMgr, EffectManager* pEffectMgr)
{
_pJoystickMgr = pJoystickMgr;
_pEffectMgr = pEffectMgr;
_pEffectMgr = pEffectMgr;
}

bool EventHandler::keyPressed(const KeyEvent& arg)
Expand Down
16 changes: 8 additions & 8 deletions demos/OISConsoleDemo/OISConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ bool appRunning = true; //Global Exit Flag

const char* g_DeviceType[6] = { "OISUnknown", "OISKeyboard", "OISMouse", "OISJoyStick", "OISTablet", "OISOther" };

InputManager* g_InputManager = nullptr; //Our Input System
Keyboard* g_kb = nullptr; //Keyboard Device
Mouse* g_m = nullptr; //Mouse Device
InputManager* g_InputManager = nullptr; //Our Input System
Keyboard* g_kb = nullptr; //Keyboard Device
Mouse* g_m = nullptr; //Mouse Device
JoyStick* g_joys[4] = { nullptr, nullptr, nullptr, nullptr }; //This demo supports up to 4 controllers

//-- OS Specific Globals --//
#if defined OIS_WIN32_PLATFORM
HWND hWnd = nullptr;
#elif defined OIS_LINUX_PLATFORM
Display* xDisp = 0;
Window xWin = 0;
Window xWin = 0;
#elif defined OIS_APPLE_PLATFORM
WindowRef mWin = 0;
#endif
Expand All @@ -94,8 +94,8 @@ WindowRef mWin = 0;
class EventHandler : public KeyListener, public MouseListener, public JoyStickListener
{
public:
EventHandler() {}
~EventHandler() {}
EventHandler() { }
~EventHandler() { }
bool keyPressed(const KeyEvent& arg)
{
std::cout << " KeyPressed {" << std::hex << arg.key << std::dec
Expand Down Expand Up @@ -163,7 +163,7 @@ class EventHandler : public KeyListener, public MouseListener, public JoyStickLi
bool sliderMoved(const JoyStickEvent& arg, int index)
{
std::cout << std::endl
<< arg.device->vendor() << ". Slider # " << index
<< arg.device->vendor() << ". Slider # " << index
<< " X Value: " << arg.state.mSliders[index].abX
<< " Y Value: " << arg.state.mSliders[index].abY;
return true;
Expand Down Expand Up @@ -344,7 +344,7 @@ void doStartup()
[NSAutoreleasePool new];
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
id menubar = [[NSMenu new] autorelease];
id menubar = [[NSMenu new] autorelease];
id appMenuItem = [[NSMenuItem new] autorelease];
[menubar addItem:appMenuItem];
[NSApp setMainMenu:menubar];
Expand Down
28 changes: 14 additions & 14 deletions includes/OISEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ namespace OIS
enum EType {
//Type ----- Pairs with force:
Unknown = 0, //UnknownForce
Constant, //ConstantForce
Constant, //ConstantForce
Ramp, //RampForce
Square, //PeriodicForce
Triangle, //PeriodicForce
Triangle, //PeriodicForce
Sine, //PeriodicForce
SawToothUp, //PeriodicForce
SawToothUp, //PeriodicForce
SawToothDown, //PeriodicForce
Friction, //ConditionalForce
Friction, //ConditionalForce
Damper, //ConditionalForce
Inertia, //ConditionalForce
Spring, //ConditionalForce
Expand Down Expand Up @@ -170,7 +170,7 @@ namespace OIS
class _OISExport ForceEffect
{
public:
virtual ~ForceEffect() {}
virtual ~ForceEffect() { }
};

//-----------------------------------------------------------------------------//
Expand All @@ -183,7 +183,7 @@ namespace OIS
{
public:
Envelope() :
attackLength(0), attackLevel(0), fadeLength(0), fadeLevel(0) {}
attackLength(0), attackLevel(0), fadeLength(0), fadeLevel(0) { }
#if defined(OIS_MSVC_COMPILER)
#pragma warning(push)
#pragma warning(disable : 4800)
Expand Down Expand Up @@ -219,9 +219,9 @@ namespace OIS
{
public:
ConstantEffect() :
level(5000) {}
level(5000) { }

Envelope envelope; //Optional envolope
Envelope envelope; //Optional envolope
signed short level; //-10K to +10k
};

Expand All @@ -233,11 +233,11 @@ namespace OIS
{
public:
RampEffect() :
startLevel(0), endLevel(0) {}
startLevel(0), endLevel(0) { }

Envelope envelope; //Optional envelope
signed short startLevel; //-10K to +10k
signed short endLevel; //-10K to +10k
signed short endLevel; //-10K to +10k
};

//-----------------------------------------------------------------------------//
Expand All @@ -248,7 +248,7 @@ namespace OIS
{
public:
PeriodicEffect() :
magnitude(0), offset(0), phase(0), period(0) {}
magnitude(0), offset(0), phase(0), period(0) { }

Envelope envelope; //Optional Envelope

Expand All @@ -267,13 +267,13 @@ namespace OIS
public:
ConditionalEffect() :
rightCoeff(0), leftCoeff(0), rightSaturation(0), leftSaturation(0),
deadband(0), center(0) {}
deadband(0), center(0) { }

signed short rightCoeff; //-10k to +10k (Positive Coeff)
signed short leftCoeff; //-10k to +10k (Negative Coeff)
signed short leftCoeff; //-10k to +10k (Negative Coeff)

unsigned short rightSaturation; //0 to 10k (Pos Saturation)
unsigned short leftSaturation; //0 to 10k (Neg Saturation)
unsigned short leftSaturation; //0 to 10k (Neg Saturation)

//Region around center in which the condition is not active, in the range
//from 0 through 10,000
Expand Down
4 changes: 2 additions & 2 deletions includes/OISEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ namespace OIS
{
public:
explicit EventArg(Object* obj) :
device(obj) {}
virtual ~EventArg() {}
device(obj) { }
virtual ~EventArg() { }

//! Pointer to the Input Device
const Object* device;
Expand Down
6 changes: 3 additions & 3 deletions includes/OISException.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ namespace OIS
public:
//! Creates exception object
Exception(OIS_ERROR err, const char* str, int line, const char* file) :
eType(err), eLine(line), eFile(file), eText(str) {}
eType(err), eLine(line), eFile(file), eText(str) { }

Exception(const Exception& other) :
eType(other.eType), eLine(other.eLine), eFile(other.eFile), eText(other.eText) {}
eType(other.eType), eLine(other.eLine), eFile(other.eFile), eText(other.eText) { }

~Exception() throw() {}
~Exception() throw() { }

virtual const char* what() const throw();

Expand Down
2 changes: 1 addition & 1 deletion includes/OISFactoryCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace OIS
/**
@remarks Virtual Destructor
*/
virtual ~FactoryCreator(){};
virtual ~FactoryCreator() {};

/**
@remarks Return a list of all unused devices the factory maintains
Expand Down
2 changes: 1 addition & 1 deletion includes/OISForceFeedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace OIS
{
public:
ForceFeedback();
virtual ~ForceFeedback() {}
virtual ~ForceFeedback() { }

/**
@remarks
Expand Down
4 changes: 2 additions & 2 deletions includes/OISInputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ namespace OIS

//! All generic devices OIS supports internally (if they are compiled in)
enum AddOnFactories {
AddOn_All = 0, //All Devices
AddOn_LIRC = 1, //PC Linux Infrared Remote Control
AddOn_All = 0, //All Devices
AddOn_LIRC = 1, //PC Linux Infrared Remote Control
AddOn_WiiMote = 2 //PC WiiMote Support
};

Expand Down
2 changes: 1 addition & 1 deletion includes/OISInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace OIS
class _OISExport Interface
{
public:
virtual ~Interface(){};
virtual ~Interface() {};

//! Type of Interface
enum IType {
Expand Down
Loading

0 comments on commit 6edb487

Please sign in to comment.