onepad: clean the gamepad/joystick interface

Remove return of empty function
Use final/override qualifier
Remove useless virtual

Thanks turtleli for the advices
This commit is contained in:
Gregory Hainaut 2017-04-26 20:12:46 +02:00
parent f91faacc53
commit 5b4c948e43
2 changed files with 9 additions and 10 deletions

View File

@ -17,7 +17,6 @@ public:
virtual ~GamePad()
{
return;
}
GamePad(const GamePad &); // copy constructor
@ -37,7 +36,7 @@ public:
* Causes devices to rumble
* Rumble will differ according to type which is either 0(small motor) or 1(big motor)
*/
virtual void Rumble(unsigned type, unsigned pad) { return; }
virtual void Rumble(unsigned type, unsigned pad) {}
/*
* Safely dispatch to the Rumble method above
*/
@ -52,7 +51,7 @@ public:
virtual int GetInput(gamePadValues input) = 0;
virtual int GetDeadzone()
int GetDeadzone()
{
return m_deadzone;
}

View File

@ -29,7 +29,7 @@
#include "controller.h"
#define NB_EFFECT 2 // Don't use more than two, ps2 only has one for big motor and one for small(like most systems)
// holds all joystick info
class JoystickInfo : GamePad
class JoystickInfo : public GamePad
{
public:
JoystickInfo(int id);
@ -42,17 +42,17 @@ public:
// opens handles to all possible joysticks
static void EnumerateJoysticks(std::vector<std::unique_ptr<GamePad>> &vjoysticks);
void Rumble(unsigned type, unsigned pad);
void Rumble(unsigned type, unsigned pad) override;
bool TestForce(float);
bool TestForce(float) override;
virtual const char *GetName();
const char *GetName() final;
virtual int GetInput(gamePadValues input);
int GetInput(gamePadValues input) final;
virtual void UpdateGamePadState();
void UpdateGamePadState() final;
virtual size_t GetUniqueIdentifier();
size_t GetUniqueIdentifier() final;
private:
SDL_GameController *m_controller;