mirror of
https://github.com/NepEgor/OpenTrackpadController.git
synced 2024-11-15 18:12:46 +00:00
Sensitivity and Genshin button map
This commit is contained in:
parent
7f4be55ecf
commit
1328adb0e9
@ -7,13 +7,15 @@ class TouchMouseJoustick : public TouchJoystick
|
||||
{
|
||||
protected:
|
||||
|
||||
float delta2usb;
|
||||
float sensitivity;
|
||||
float trackball_friction;
|
||||
|
||||
public:
|
||||
|
||||
void init(int32_t pos_x, int32_t pos_y, int32_t pos_r, int16_t usb_x, int16_t usb_y, int16_t usb_r);
|
||||
|
||||
void setSensitivity(float sensitivity);
|
||||
|
||||
void setTrackballFriction(float trackball_friction);
|
||||
|
||||
int8_t touch(int8_t fid, int32_t tx, int32_t ty, int32_t tdx, int32_t tdy);
|
||||
|
@ -8,7 +8,12 @@ void TouchMouseJoustick::init(int32_t pos_x, int32_t pos_y, int32_t pos_r, int16
|
||||
|
||||
this->control_type = CT_MOUSE_JOYSTICK;
|
||||
|
||||
this->delta2usb = this->pos2usb * 30;
|
||||
this->sensitivity = this->pos2usb;
|
||||
}
|
||||
|
||||
void TouchMouseJoustick::setSensitivity(float sensitivity)
|
||||
{
|
||||
this->sensitivity = this->pos2usb * sensitivity;
|
||||
}
|
||||
|
||||
void TouchMouseJoustick::setTrackballFriction(float trackball_friction)
|
||||
@ -45,11 +50,14 @@ int8_t TouchMouseJoustick::touch(int8_t fid, int32_t tx, int32_t ty, int32_t tdx
|
||||
|
||||
if (t2 <= dead_zone_outer2)
|
||||
{
|
||||
int32_t x32 = -tdx * delta2usb + usb_x;
|
||||
int32_t y32 = -tdy * delta2usb + usb_y;
|
||||
int32_t x32 = -tdx * sensitivity;
|
||||
int32_t y32 = -tdy * sensitivity;
|
||||
|
||||
x = x32 > usb_r? usb_r : (x32 < -usb_r? -usb_r : x32);
|
||||
y = y32 > usb_r? usb_r : (y32 < -usb_r? -usb_r : y32);
|
||||
|
||||
x + usb_x;
|
||||
y + usb_y;
|
||||
}
|
||||
else // in bounds outside of outer dead zone - edge spin
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ namespace InputMapper
|
||||
};
|
||||
|
||||
const uint8_t num_controls = sizeof(tcontrols) / sizeof(TouchControl*[2]);
|
||||
|
||||
/*
|
||||
uint16_t button_map[] =
|
||||
{
|
||||
USB_Device::START,
|
||||
@ -44,6 +44,22 @@ namespace InputMapper
|
||||
USB_Device::FACE_X,
|
||||
USB_Device::FACE_Y,
|
||||
};
|
||||
*/
|
||||
// Genshin map
|
||||
uint16_t button_map[] =
|
||||
{
|
||||
USB_Device::START,
|
||||
USB_Device::SELECT,
|
||||
USB_Device::FACE_B,
|
||||
USB_Device::FACE_X,
|
||||
USB_Device::BUMPER_LEFT,
|
||||
USB_Device::BUMPER_RIGHT,
|
||||
USB_Device::HOME,
|
||||
USB_Device::FACE_A,
|
||||
USB_Device::JOYSTICK_RIGHT,
|
||||
USB_Device::FACE_A,
|
||||
USB_Device::JOYSTICK_LEFT,
|
||||
};
|
||||
|
||||
uint16_t dpad_left_map[] =
|
||||
{
|
||||
@ -90,6 +106,7 @@ namespace InputMapper
|
||||
tjoystick_right.init(pos_x, pos_y, pos_r, USB_Device::usb_joystick_x, USB_Device::usb_joystick_y, USB_Device::usb_joystick_r);
|
||||
//tjoystick_right.setDeadZoneInner(dead_zone_inner);
|
||||
tjoystick_right.setDeadZoneOuter(dead_zone_outer);
|
||||
tjoystick_right.setSensitivity(10);
|
||||
|
||||
pos_x = 20.636 * ppmX;
|
||||
pos_y = 20.636 * ppmY;
|
||||
|
Loading…
Reference in New Issue
Block a user