fixup! fixup! Refactor input system
This commit is contained in:
parent
6d49e4621c
commit
6cccdcacd2
|
@ -75,14 +75,14 @@ public:
|
||||||
/**
|
/**
|
||||||
* Signals a button press action to the HID module.
|
* Signals a button press action to the HID module.
|
||||||
* @param pad_state indicates which button to press
|
* @param pad_state indicates which button to press
|
||||||
* @note only handle real buttons (A/B/X/Y/...), excluding analog input like circle pad.
|
* @note only handles real buttons (A/B/X/Y/...), excluding analog inputs like the circle pad.
|
||||||
*/
|
*/
|
||||||
void ButtonPressed(Service::HID::PadState pad_state);
|
void ButtonPressed(Service::HID::PadState pad_state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signals a button release action to the HID module.
|
* Signals a button release action to the HID module.
|
||||||
* @param pad_state indicates which button to press
|
* @param pad_state indicates which button to press
|
||||||
* @note only handle real buttons (A/B/X/Y/...), excluding analog input like circle pad.
|
* @note only handles real buttons (A/B/X/Y/...), excluding analog inputs like the circle pad.
|
||||||
*/
|
*/
|
||||||
void ButtonReleased(Service::HID::PadState pad_state);
|
void ButtonReleased(Service::HID::PadState pad_state);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current cirle pad state.
|
* Gets the current circle pad state.
|
||||||
* @note This should be called by the core emu thread to get a state set by the window thread.
|
* @note This should be called by the core emu thread to get a state set by the window thread.
|
||||||
* @todo Fix this function to be thread-safe.
|
* @todo Fix this function to be thread-safe.
|
||||||
* @return std::tuple of (x, y), where `x` and `y` are the circle pad coordinates
|
* @return std::tuple of (x, y), where `x` and `y` are the circle pad coordinates
|
||||||
|
|
|
@ -13,7 +13,7 @@ class EmuWindow;
|
||||||
namespace KeyMap {
|
namespace KeyMap {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a key mapping target that are not 3DS real buttons.
|
* Represents key mapping targets that are not real 3DS buttons.
|
||||||
* They will be handled by KeyMap and translated to 3DS input.
|
* They will be handled by KeyMap and translated to 3DS input.
|
||||||
*/
|
*/
|
||||||
enum class IndirectTarget {
|
enum class IndirectTarget {
|
||||||
|
@ -25,7 +25,7 @@ enum class IndirectTarget {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a key mapping target. It can be a PadState that represents 3DS real buttons,
|
* Represents a key mapping target. It can be a PadState that represents real 3DS buttons,
|
||||||
* or an IndirectTarget.
|
* or an IndirectTarget.
|
||||||
*/
|
*/
|
||||||
struct KeyTarget {
|
struct KeyTarget {
|
||||||
|
@ -84,12 +84,12 @@ void SetKeyMapping(HostDeviceKey key, KeyTarget target);
|
||||||
void ClearKeyMapping(int device_id);
|
void ClearKeyMapping(int device_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps a key press actions and call the corresponding function in EmuWindow
|
* Maps a key press action and call the corresponding function in EmuWindow
|
||||||
*/
|
*/
|
||||||
void PressKey(EmuWindow& emu_window, HostDeviceKey key);
|
void PressKey(EmuWindow& emu_window, HostDeviceKey key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps a key release actions and call the corresponding function in EmuWindow
|
* Maps a key release action and call the corresponding function in EmuWindow
|
||||||
*/
|
*/
|
||||||
void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key);
|
void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ void Update() {
|
||||||
|
|
||||||
PadState state = VideoCore::g_emu_window->GetPadState();
|
PadState state = VideoCore::g_emu_window->GetPadState();
|
||||||
|
|
||||||
// Get current circle pad positon and update circle pad direction
|
// Get current circle pad position and update circle pad direction
|
||||||
s16 circle_pad_x, circle_pad_y;
|
s16 circle_pad_x, circle_pad_y;
|
||||||
std::tie(circle_pad_x, circle_pad_y) = VideoCore::g_emu_window->GetCirclePadState();
|
std::tie(circle_pad_x, circle_pad_y) = VideoCore::g_emu_window->GetCirclePadState();
|
||||||
state.hex |= GetCirclePadDirectionState(circle_pad_x, circle_pad_y).hex;
|
state.hex |= GetCirclePadDirectionState(circle_pad_x, circle_pad_y).hex;
|
||||||
|
|
Loading…
Reference in New Issue