mirror of https://github.com/stella-emu/stella.git
More 'enum class' and associated cleanups.
This commit is contained in:
parent
e4ef7cc01b
commit
a947553bad
|
@ -42,105 +42,67 @@ MouseControl::MouseControl(Console& console, const string& mode)
|
||||||
m_mode[0] >= '0' && m_mode[0] <= '8' &&
|
m_mode[0] >= '0' && m_mode[0] <= '8' &&
|
||||||
m_mode[1] >= '0' && m_mode[1] <= '8')
|
m_mode[1] >= '0' && m_mode[1] <= '8')
|
||||||
{
|
{
|
||||||
Axis xaxis = Axis(int(m_mode[0]) - '0');
|
MouseControl::Type xaxis = MouseControl::Type(int(m_mode[0]) - '0');
|
||||||
Axis yaxis = Axis(int(m_mode[1]) - '0');
|
MouseControl::Type yaxis = MouseControl::Type(int(m_mode[1]) - '0');
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "Mouse X-axis is ";
|
|
||||||
Controller::Type xtype = Controller::Type::Joystick, ytype = Controller::Type::Joystick;
|
Controller::Type xtype = Controller::Type::Joystick, ytype = Controller::Type::Joystick;
|
||||||
int xid = -1, yid = -1;
|
int xid = -1, yid = -1;
|
||||||
switch(xaxis)
|
|
||||||
|
auto MControlToController = [&msg](MouseControl::Type axis,
|
||||||
|
Controller::Type& type, int& id) {
|
||||||
|
switch(axis)
|
||||||
{
|
{
|
||||||
case NoControl:
|
case MouseControl::Type::NoControl:
|
||||||
msg << "not used";
|
msg << "not used";
|
||||||
break;
|
break;
|
||||||
case Paddle0:
|
case MouseControl::Type::Paddle0:
|
||||||
xtype = Controller::Type::Paddles;
|
type = Controller::Type::Paddles;
|
||||||
xid = 0;
|
id = 0;
|
||||||
msg << "Paddle 0";
|
msg << "Paddle 0";
|
||||||
break;
|
break;
|
||||||
case Paddle1:
|
case MouseControl::Type::Paddle1:
|
||||||
xtype = Controller::Type::Paddles;
|
type = Controller::Type::Paddles;
|
||||||
xid = 1;
|
id = 1;
|
||||||
msg << "Paddle 1";
|
msg << "Paddle 1";
|
||||||
break;
|
break;
|
||||||
case Paddle2:
|
case MouseControl::Type::Paddle2:
|
||||||
xtype = Controller::Type::Paddles;
|
type = Controller::Type::Paddles;
|
||||||
xid = 2;
|
id = 2;
|
||||||
msg << "Paddle 2";
|
msg << "Paddle 2";
|
||||||
break;
|
break;
|
||||||
case Paddle3:
|
case MouseControl::Type::Paddle3:
|
||||||
xtype = Controller::Type::Paddles;
|
type = Controller::Type::Paddles;
|
||||||
xid = 3;
|
id = 3;
|
||||||
msg << "Paddle 3";
|
msg << "Paddle 3";
|
||||||
break;
|
break;
|
||||||
case Driving0:
|
case MouseControl::Type::Driving0:
|
||||||
xtype = Controller::Type::Driving;
|
type = Controller::Type::Driving;
|
||||||
xid = 0;
|
id = 0;
|
||||||
msg << "Driving 0";
|
msg << "Driving 0";
|
||||||
break;
|
break;
|
||||||
case Driving1:
|
case MouseControl::Type::Driving1:
|
||||||
xtype = Controller::Type::Driving;
|
type = Controller::Type::Driving;
|
||||||
xid = 1;
|
id = 1;
|
||||||
msg << "Driving 1";
|
msg << "Driving 1";
|
||||||
break;
|
break;
|
||||||
case MindLink0:
|
case MouseControl::Type::MindLink0:
|
||||||
xtype = Controller::Type::MindLink;
|
type = Controller::Type::MindLink;
|
||||||
xid = 0;
|
id = 0;
|
||||||
msg << "MindLink 0";
|
msg << "MindLink 0";
|
||||||
break;
|
break;
|
||||||
case MindLink1:
|
case MouseControl::Type::MindLink1:
|
||||||
xtype = Controller::Type::MindLink;
|
type = Controller::Type::MindLink;
|
||||||
xid = 1;
|
id = 1;
|
||||||
msg << "MindLink 1";
|
msg << "MindLink 1";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
msg << "Mouse X-axis is ";
|
||||||
|
MControlToController(xaxis, xtype, xid);
|
||||||
msg << ", Y-axis is ";
|
msg << ", Y-axis is ";
|
||||||
switch(yaxis)
|
MControlToController(yaxis, ytype, yid);
|
||||||
{
|
|
||||||
case NoControl:
|
|
||||||
msg << "not used";
|
|
||||||
break;
|
|
||||||
case Paddle0:
|
|
||||||
ytype = Controller::Type::Paddles;
|
|
||||||
yid = 0;
|
|
||||||
msg << "Paddle 0";
|
|
||||||
break;
|
|
||||||
case Paddle1:
|
|
||||||
ytype = Controller::Type::Paddles;
|
|
||||||
yid = 1;
|
|
||||||
msg << "Paddle 1";
|
|
||||||
break;
|
|
||||||
case Paddle2:
|
|
||||||
ytype = Controller::Type::Paddles;
|
|
||||||
yid = 2;
|
|
||||||
msg << "Paddle 2";
|
|
||||||
break;
|
|
||||||
case Paddle3:
|
|
||||||
ytype = Controller::Type::Paddles;
|
|
||||||
yid = 3;
|
|
||||||
msg << "Paddle 3";
|
|
||||||
break;
|
|
||||||
case Driving0:
|
|
||||||
ytype = Controller::Type::Driving;
|
|
||||||
yid = 0;
|
|
||||||
msg << "Driving 0";
|
|
||||||
break;
|
|
||||||
case Driving1:
|
|
||||||
ytype = Controller::Type::Driving;
|
|
||||||
yid = 1;
|
|
||||||
msg << "Driving 1";
|
|
||||||
break;
|
|
||||||
case MindLink0:
|
|
||||||
ytype = Controller::Type::MindLink;
|
|
||||||
yid = 0;
|
|
||||||
msg << "MindLink 0";
|
|
||||||
break;
|
|
||||||
case MindLink1:
|
|
||||||
ytype = Controller::Type::MindLink;
|
|
||||||
yid = 1;
|
|
||||||
msg << "MindLink 1";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
myModeList.push_back(MouseMode(xtype, xid, ytype, yid, msg.str()));
|
myModeList.push_back(MouseMode(xtype, xid, ytype, yid, msg.str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class MouseControl
|
||||||
/**
|
/**
|
||||||
Enumeration of mouse axis control types
|
Enumeration of mouse axis control types
|
||||||
*/
|
*/
|
||||||
enum Axis
|
enum class Type
|
||||||
{
|
{
|
||||||
Paddle0 = 0, Paddle1, Paddle2, Paddle3,
|
Paddle0 = 0, Paddle1, Paddle2, Paddle3,
|
||||||
Driving0, Driving1, MindLink0, MindLink1,
|
Driving0, Driving1, MindLink0, MindLink1,
|
||||||
|
|
|
@ -247,15 +247,15 @@ GameInfoDialog::GameInfoDialog(
|
||||||
// Mouse controller specific axis
|
// Mouse controller specific axis
|
||||||
pwidth = font.getStringWidth("MindLink 0");
|
pwidth = font.getStringWidth("MindLink 0");
|
||||||
items.clear();
|
items.clear();
|
||||||
VarList::push_back(items, "None", MouseControl::NoControl);
|
VarList::push_back(items, "None", static_cast<uInt32>(MouseControl::Type::NoControl));
|
||||||
VarList::push_back(items, "Paddle 0", MouseControl::Paddle0);
|
VarList::push_back(items, "Paddle 0", static_cast<uInt32>(MouseControl::Type::Paddle0));
|
||||||
VarList::push_back(items, "Paddle 1", MouseControl::Paddle1);
|
VarList::push_back(items, "Paddle 1", static_cast<uInt32>(MouseControl::Type::Paddle1));
|
||||||
VarList::push_back(items, "Paddle 2", MouseControl::Paddle2);
|
VarList::push_back(items, "Paddle 2", static_cast<uInt32>(MouseControl::Type::Paddle2));
|
||||||
VarList::push_back(items, "Paddle 3", MouseControl::Paddle3);
|
VarList::push_back(items, "Paddle 3", static_cast<uInt32>(MouseControl::Type::Paddle3));
|
||||||
VarList::push_back(items, "Driving 0", MouseControl::Driving0);
|
VarList::push_back(items, "Driving 0", static_cast<uInt32>(MouseControl::Type::Driving0));
|
||||||
VarList::push_back(items, "Driving 1", MouseControl::Driving1);
|
VarList::push_back(items, "Driving 1", static_cast<uInt32>(MouseControl::Type::Driving1));
|
||||||
VarList::push_back(items, "MindLink 0", MouseControl::MindLink0);
|
VarList::push_back(items, "MindLink 0", static_cast<uInt32>(MouseControl::Type::MindLink0));
|
||||||
VarList::push_back(items, "MindLink 1", MouseControl::MindLink1);
|
VarList::push_back(items, "MindLink 1", static_cast<uInt32>(MouseControl::Type::MindLink1));
|
||||||
|
|
||||||
xpos += 20;
|
xpos += 20;
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
Loading…
Reference in New Issue