Review Changes 13 - const reference, public member documentation, enum class

This commit is contained in:
Daniel Stuart Baxter 2015-05-31 15:09:39 -05:00
parent 1be629b345
commit 8ac1bb3b04
3 changed files with 30 additions and 11 deletions

View File

@ -32,11 +32,11 @@ static void InputCallback(u64 userdata, int cycles_late) {
CoreTiming::ScheduleEvent(frame_ticks - cycles_late, input_event);
}
std::string InputBase::GetDeviceName() const {
const std::string& InputBase::GetDeviceName() const {
return device_name;
}
Service::HID::PadState InputBase::GetPadState() const {
const Service::HID::PadState& InputBase::GetPadState() const {
return controller.pad_state;
}

View File

@ -10,7 +10,7 @@
namespace InputCommon {
/// Enum defining available backends
enum InputBackends {
enum class InputBackends {
NONE,
SDL2
};
@ -30,14 +30,21 @@ public:
virtual void Poll() = 0;
/// Shuts down all backend related data
virtual void Shutdown() = 0;
virtual void Shutdown() = 0;
/// Returns internal name of currently selected device. Expose this to the UI
std::string GetDeviceName() const;
/**
* Returns internal name of currently selected device. Expose this to the UI
* @returns A string of the device name, e.g. "SDL::PS3 Controller"
*/
const std::string& GetDeviceName() const;
/// Returns internal pad state
Service::HID::PadState GetPadState() const;
/**
* Returns internal pad state
* @returns PadState structure from the HID service
*/
const Service::HID::PadState& GetPadState() const;
/// Current input system activation status
bool activated;
protected:
@ -48,7 +55,10 @@ protected:
ControllerState controller;
};
/// Initialize the user input system
/**
* Initializes the user input system
* @param backend Enumeration of the backend to use
*/
void Init(InputBackends backend);
/// Deactive the user input system

View File

@ -33,10 +33,19 @@ public:
/// Sets up keymaps from input configuration
void SetupKeyMaps();
/// Sets analog deadzones
/**
* Sets analog deadzones
* @param range Value SDL assigns for analog input
* Applicable values (-32768 to 32767)
*/
void SetDeadZone(int range);
/// Checks if analog input is within the dead zone
/**
* Checks if analog input is within the dead zone
* @param range Value SDL assigns for analog input
* Applicable values (-32768 to 32767)
* @return True if outside dead zone, false otherwise
*/
bool CheckDeadZone(int range) const;
private: