mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 15:01:03 +00:00
Review Changes 13 - const reference, public member documentation, enum class
This commit is contained in:
parent
1be629b345
commit
8ac1bb3b04
@ -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;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
namespace InputCommon {
|
||||
|
||||
/// Enum defining available backends
|
||||
enum InputBackends {
|
||||
enum class InputBackends {
|
||||
NONE,
|
||||
SDL2
|
||||
};
|
||||
@ -32,12 +32,19 @@ public:
|
||||
/// Shuts down all backend related data
|
||||
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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user