Minor updates and commenting for PhysicalJoystickHandler.

This commit is contained in:
Stephen Anthony 2018-03-18 15:58:41 -02:30
parent 9a4b14392b
commit 3ce71302b7
2 changed files with 22 additions and 16 deletions

View File

@ -49,21 +49,6 @@ PhysicalJoystickHandler::PhysicalJoystickHandler(
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::printDatabase() const
{
cerr << "---------------------------------------------------------" << endl
<< "joy database:" << endl;
for(const auto& i: myDatabase)
cerr << i.first << endl << i.second << endl << endl;
cerr << "---------------------" << endl
<< "joy active:" << endl;
for(const auto& i: mySticks)
cerr << i.first << ": " << *i.second << endl;
cerr << "---------------------------------------------------------" << endl << endl << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int PhysicalJoystickHandler::add(PhysicalJoystickPtr stick)
{
@ -721,6 +706,24 @@ VariantList PhysicalJoystickHandler::database() const
return db;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh)
{
os << "---------------------------------------------------------" << endl
<< "joy database:" << endl;
for(const auto& i: jh.myDatabase)
os << i.first << endl << i.second << endl << endl;
os << "---------------------" << endl
<< "joy active:" << endl;
for(const auto& i: jh.mySticks)
os << i.first << ": " << *i.second << endl;
os << "---------------------------------------------------------"
<< endl << endl << endl;
return os;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Used by the Stelladaptor to send absolute axis values
const Event::Type PhysicalJoystickHandler::SA_Axis[2][2] = {

View File

@ -96,6 +96,7 @@ class PhysicalJoystickHandler
return j ? j->hatTable[hat][int(value)][mode] : Event::NoType;
}
/** Returns a list of pairs consisting of joystick name and associated ID. */
VariantList database() const;
private:
@ -119,8 +120,10 @@ class PhysicalJoystickHandler
return i != mySticks.cend() ? i->second : nullptr;
}
// Set default mapping for given joystick when no mappings already exist
void setStickDefaultMapping(int stick, Event::Type type, EventMode mode);
void printDatabase() const;
friend ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh);
// Static lookup tables for Stelladaptor/2600-daptor axis/button support
static const Event::Type SA_Axis[2][2];