mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Light cleanup to a little bit of InputCommon. Replaces much of the iterators that litter this section of the codebase.
Also clean up a little bit of the comments that describe the interface classes.
This commit is contained in:
@ -42,7 +42,7 @@ enum
|
||||
SETTING_SQUARE,
|
||||
};
|
||||
|
||||
const char * const named_directions[] =
|
||||
const char* const named_directions[] =
|
||||
{
|
||||
"Up",
|
||||
"Down",
|
||||
@ -61,13 +61,13 @@ public:
|
||||
class Control
|
||||
{
|
||||
protected:
|
||||
Control(ControllerInterface::ControlReference* const _ref, const char * const _name)
|
||||
Control(ControllerInterface::ControlReference* const _ref, const char* const _name)
|
||||
: control_ref(_ref), name(_name){}
|
||||
public:
|
||||
|
||||
virtual ~Control();
|
||||
ControllerInterface::ControlReference* const control_ref;
|
||||
const char * const name;
|
||||
ControllerInterface::ControlReference* const control_ref;
|
||||
const char* const name;
|
||||
|
||||
};
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
Input(const char * const _name)
|
||||
Input(const char* const _name)
|
||||
: Control(new ControllerInterface::InputReference, _name) {}
|
||||
|
||||
};
|
||||
@ -84,7 +84,7 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
Output(const char * const _name)
|
||||
Output(const char* const _name)
|
||||
: Control(new ControllerInterface::OutputReference, _name) {}
|
||||
|
||||
};
|
||||
@ -94,17 +94,17 @@ public:
|
||||
public:
|
||||
|
||||
Setting(const char* const _name, const ControlState def_value
|
||||
, const unsigned int _low = 0, const unsigned int _high = 100 )
|
||||
, const unsigned int _low = 0, const unsigned int _high = 100)
|
||||
: name(_name)
|
||||
, value(def_value)
|
||||
, default_value(def_value)
|
||||
, low(_low)
|
||||
, high(_high){}
|
||||
|
||||
const char* const name;
|
||||
ControlState value;
|
||||
const ControlState default_value;
|
||||
const unsigned int low, high;
|
||||
const char* const name;
|
||||
ControlState value;
|
||||
const ControlState default_value;
|
||||
const unsigned int low, high;
|
||||
};
|
||||
|
||||
ControlGroup(const char* const _name, const unsigned int _type = GROUP_TYPE_OTHER) : name(_name), type(_type) {}
|
||||
@ -113,11 +113,11 @@ public:
|
||||
virtual void LoadConfig(IniFile::Section *sec, const std::string& defdev = "", const std::string& base = "" );
|
||||
virtual void SaveConfig(IniFile::Section *sec, const std::string& defdev = "", const std::string& base = "" );
|
||||
|
||||
const char* const name;
|
||||
const unsigned int type;
|
||||
const char* const name;
|
||||
const unsigned int type;
|
||||
|
||||
std::vector< Control* > controls;
|
||||
std::vector< Setting* > settings;
|
||||
std::vector<Control*> controls;
|
||||
std::vector<Setting*> settings;
|
||||
|
||||
};
|
||||
|
||||
@ -194,14 +194,12 @@ public:
|
||||
template <typename C>
|
||||
void GetState(C* const buttons, const C* bitmasks)
|
||||
{
|
||||
std::vector<Control*>::iterator
|
||||
i = controls.begin(),
|
||||
e = controls.end();
|
||||
|
||||
for (; i!=e; ++i, ++bitmasks)
|
||||
for (Control* control : controls)
|
||||
{
|
||||
if ((*i)->control_ref->State() > settings[0]->value) // threshold
|
||||
if (control->control_ref->State() > settings[0]->value) // threshold
|
||||
*buttons |= *bitmasks;
|
||||
|
||||
bitmasks++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,12 +285,13 @@ public:
|
||||
tmpf = ((state - (deadzone * sign(state))) / (1 - deadzone));
|
||||
|
||||
float &ax = m_swing[i >> 1];
|
||||
*axis++ = (C)((tmpf - ax) * range + base);
|
||||
*axis++ = (C)((tmpf - ax) * range + base);
|
||||
ax = tmpf;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
float m_swing[3];
|
||||
float m_swing[3];
|
||||
};
|
||||
|
||||
class Tilt : public ControlGroup
|
||||
@ -370,8 +369,9 @@ public:
|
||||
*y = C(m_tilt[1] * angle * range + base);
|
||||
*x = C(m_tilt[0] * angle * range + base);
|
||||
}
|
||||
|
||||
private:
|
||||
float m_tilt[2];
|
||||
float m_tilt[2];
|
||||
};
|
||||
|
||||
class Cursor : public ControlGroup
|
||||
@ -415,7 +415,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
float m_z;
|
||||
float m_z;
|
||||
};
|
||||
|
||||
class Extension : public ControlGroup
|
||||
@ -429,10 +429,10 @@ public:
|
||||
|
||||
void GetState(u8* const data, const bool focus = true);
|
||||
|
||||
std::vector<ControllerEmu*> attachments;
|
||||
std::vector<ControllerEmu*> attachments;
|
||||
|
||||
int switch_extension;
|
||||
int active_extension;
|
||||
int switch_extension;
|
||||
int active_extension;
|
||||
};
|
||||
|
||||
virtual ~ControllerEmu();
|
||||
@ -447,9 +447,9 @@ public:
|
||||
|
||||
void UpdateReferences(ControllerInterface& devi);
|
||||
|
||||
std::vector< ControlGroup* > groups;
|
||||
std::vector<ControlGroup*> groups;
|
||||
|
||||
DeviceQualifier default_device;
|
||||
DeviceQualifier default_device;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user