mirror of https://github.com/stella-emu/stella.git
Minor refactoring with Controller::isAnalog() usage.
This commit is contained in:
parent
3ce71302b7
commit
0cde1ec4b9
|
@ -94,6 +94,9 @@ class Console : public Serializable
|
|||
*/
|
||||
Controller& leftController() const { return *myLeftControl; }
|
||||
Controller& rightController() const { return *myRightControl; }
|
||||
Controller& controller(Controller::Jack jack) const {
|
||||
return jack == Controller::Left ? leftController() : rightController();
|
||||
}
|
||||
|
||||
/**
|
||||
Get the TIA for this console
|
||||
|
|
|
@ -1695,15 +1695,6 @@ void EventHandler::takeSnapshot(uInt32 number)
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool EventHandler::controllerIsAnalog(Controller::Jack jack) const
|
||||
{
|
||||
const Controller& controller = jack == Controller::Left ?
|
||||
myOSystem.console().leftController() : myOSystem.console().rightController();
|
||||
|
||||
return controller.isAnalog();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::setMouseControllerMode(const string& enable)
|
||||
{
|
||||
|
@ -1716,8 +1707,8 @@ void EventHandler::setMouseControllerMode(const string& enable)
|
|||
usemouse = false;
|
||||
else // 'analog'
|
||||
{
|
||||
usemouse = controllerIsAnalog(Controller::Left) ||
|
||||
controllerIsAnalog(Controller::Right);
|
||||
usemouse = myOSystem.console().controller(Controller::Left).isAnalog() ||
|
||||
myOSystem.console().controller(Controller::Right).isAnalog();
|
||||
}
|
||||
|
||||
const string& control = usemouse ?
|
||||
|
|
|
@ -269,14 +269,6 @@ class EventHandler
|
|||
*/
|
||||
void allowAllDirections(bool allow) { myAllowAllDirectionsFlag = allow; }
|
||||
|
||||
/**
|
||||
Determines whether the given controller must use the mouse (aka,
|
||||
whether the controller generates analog output).
|
||||
|
||||
@param jack The controller to query
|
||||
*/
|
||||
bool controllerIsAnalog(Controller::Jack jack) const;
|
||||
|
||||
/**
|
||||
Detects and changes the eventhandler state.
|
||||
|
||||
|
|
|
@ -662,8 +662,8 @@ void FrameBuffer::setCursorState()
|
|||
bool emulation =
|
||||
myOSystem.eventHandler().state() == EventHandlerState::EMULATION;
|
||||
bool analog = myOSystem.hasConsole() ?
|
||||
(myOSystem.eventHandler().controllerIsAnalog(Controller::Left) ||
|
||||
myOSystem.eventHandler().controllerIsAnalog(Controller::Right)) : false;
|
||||
(myOSystem.console().controller(Controller::Left).isAnalog() ||
|
||||
myOSystem.console().controller(Controller::Right).isAnalog()) : false;
|
||||
bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"));
|
||||
|
||||
grabMouse(emulation && (analog || alwaysUseMouse) && myGrabMouse);
|
||||
|
|
Loading…
Reference in New Issue