mirror of https://github.com/stella-emu/stella.git
Minor refactoring of Controller class:
- a controller can now answer whether it is intrinsically an analog controller
This commit is contained in:
parent
7eab28b2ef
commit
9a4b14392b
|
@ -171,6 +171,12 @@ class Controller : public Serializable
|
|||
*/
|
||||
virtual void update() = 0;
|
||||
|
||||
/**
|
||||
Answers whether the controller is intrinsically an analog controller.
|
||||
Specific controllers should override and implement this method.
|
||||
*/
|
||||
virtual bool isAnalog() const { return false; }
|
||||
|
||||
/**
|
||||
Notification method invoked by the system after its reset method has
|
||||
been called. It may be necessary to override this method for
|
||||
|
|
|
@ -47,6 +47,11 @@ class Driving : public Controller
|
|||
*/
|
||||
void update() override;
|
||||
|
||||
/**
|
||||
Answers whether the controller is intrinsically an analog controller.
|
||||
*/
|
||||
bool isAnalog() const override { return true; }
|
||||
|
||||
/**
|
||||
Determines how this controller will treat values received from the
|
||||
X/Y axis and left/right buttons of the mouse. Since not all controllers
|
||||
|
|
|
@ -1701,18 +1701,7 @@ bool EventHandler::controllerIsAnalog(Controller::Jack jack) const
|
|||
const Controller& controller = jack == Controller::Left ?
|
||||
myOSystem.console().leftController() : myOSystem.console().rightController();
|
||||
|
||||
switch(controller.type())
|
||||
{
|
||||
case Controller::Paddles:
|
||||
case Controller::Driving:
|
||||
case Controller::AmigaMouse:
|
||||
case Controller::AtariMouse:
|
||||
case Controller::TrakBall:
|
||||
case Controller::MindLink:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return controller.isAnalog();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -72,6 +72,11 @@ class MindLink : public Controller
|
|||
*/
|
||||
void update() override;
|
||||
|
||||
/**
|
||||
Answers whether the controller is intrinsically an analog controller.
|
||||
*/
|
||||
bool isAnalog() const override { return true; }
|
||||
|
||||
/**
|
||||
Determines how this controller will treat values received from the
|
||||
X/Y axis and left/right buttons of the mouse. Since not all controllers
|
||||
|
|
|
@ -54,6 +54,11 @@ class Paddles : public Controller
|
|||
*/
|
||||
void update() override;
|
||||
|
||||
/**
|
||||
Answers whether the controller is intrinsically an analog controller.
|
||||
*/
|
||||
bool isAnalog() const override { return true; }
|
||||
|
||||
/**
|
||||
Determines how this controller will treat values received from the
|
||||
X/Y axis and left/right buttons of the mouse. Since not all controllers
|
||||
|
|
|
@ -57,6 +57,11 @@ class PointingDevice : public Controller
|
|||
*/
|
||||
void update() override;
|
||||
|
||||
/**
|
||||
Answers whether the controller is intrinsically an analog controller.
|
||||
*/
|
||||
bool isAnalog() const override { return true; }
|
||||
|
||||
/**
|
||||
Determines how this controller will treat values received from the
|
||||
X/Y axis and left/right buttons of the mouse. Since not all controllers
|
||||
|
|
Loading…
Reference in New Issue