mirror of
https://github.com/NepEgor/OpenTrackpadController.git
synced 2024-11-15 18:12:46 +00:00
reset joystick when mode shifting
This commit is contained in:
parent
3b2be18f6b
commit
e19dffeacd
@ -43,6 +43,8 @@ class TouchControl
|
||||
|
||||
virtual void init(int32_t pos_x, int32_t pos_y, int32_t pos_r);
|
||||
|
||||
virtual void reset();
|
||||
|
||||
virtual TouchState touch(int8_t fid, int32_t tx, int32_t ty) = 0;
|
||||
|
||||
int8_t getTouching() {return touching;}
|
||||
|
@ -31,6 +31,8 @@ class TouchDpad : public TouchControl
|
||||
TouchDpad(int32_t pos_x, int32_t pos_y, int32_t pos_r, DpadType dpad_type = DPAD_TYPE_SECTOR_4);
|
||||
|
||||
void init(int32_t pos_x, int32_t pos_y, int32_t pos_r, DpadType dpad_type = DPAD_TYPE_SECTOR_4);
|
||||
|
||||
void reset();
|
||||
|
||||
void setDeadZoneInner(int32_t dead_zone_inner);
|
||||
|
||||
|
@ -35,6 +35,8 @@ class TouchJoystick : public TouchControl
|
||||
|
||||
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 reset();
|
||||
|
||||
void setDeadZoneInner(int32_t dead_zone_inner);
|
||||
void setDeadZoneOuter(int32_t dead_zone_outer);
|
||||
|
||||
|
@ -23,6 +23,8 @@ class TouchMouseJoystick : public TouchJoystick
|
||||
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 reset();
|
||||
|
||||
void setSensitivity(float sensitivity);
|
||||
|
||||
|
@ -18,3 +18,9 @@ void TouchControl::init(int32_t pos_x, int32_t pos_y, int32_t pos_r)
|
||||
|
||||
this->touching = TS_NONE;
|
||||
}
|
||||
|
||||
void TouchControl::reset()
|
||||
{
|
||||
this->finger_id = -1;
|
||||
this->touching = TS_NONE;
|
||||
}
|
||||
|
@ -31,6 +31,12 @@ void TouchDpad::init(int32_t pos_x, int32_t pos_y, int32_t pos_r, DpadType dpad_
|
||||
this->button = 0;
|
||||
}
|
||||
|
||||
void TouchDpad::reset()
|
||||
{
|
||||
TouchControl::reset();
|
||||
this->button = 0;
|
||||
}
|
||||
|
||||
void TouchDpad::setDeadZoneInner(int32_t dead_zone_inner)
|
||||
{
|
||||
this->dead_zone_inner = dead_zone_inner;
|
||||
|
@ -31,6 +31,13 @@ void TouchJoystick::init(int32_t pos_x, int32_t pos_y, int32_t pos_r, int16_t us
|
||||
this->y = usb_y;
|
||||
}
|
||||
|
||||
void TouchJoystick::reset()
|
||||
{
|
||||
TouchControl::reset();
|
||||
this->x = usb_x;
|
||||
this->y = usb_y;;
|
||||
}
|
||||
|
||||
void TouchJoystick::setDeadZoneInner(int32_t dead_zone_inner)
|
||||
{
|
||||
this->dead_zone_inner = dead_zone_inner;
|
||||
|
@ -19,6 +19,15 @@ void TouchMouseJoystick::init(int32_t pos_x, int32_t pos_y, int32_t pos_r, int16
|
||||
this->time0 = 0;
|
||||
}
|
||||
|
||||
void TouchMouseJoystick::reset()
|
||||
{
|
||||
TouchJoystick::reset();
|
||||
this->trackball_vel_x = 0;
|
||||
this->trackball_vel_y = 0;
|
||||
this->dx = 0;
|
||||
this->dy = 0;
|
||||
}
|
||||
|
||||
void TouchMouseJoystick::setSensitivity(float sensitivity)
|
||||
{
|
||||
this->sensitivity = this->pos2usb * sensitivity;
|
||||
|
@ -337,6 +337,8 @@ namespace InputMapper
|
||||
|
||||
case HardwareButtons::BUMPER_LEFT:
|
||||
|
||||
tcontrols[1][0]->reset();
|
||||
|
||||
if (value)
|
||||
{
|
||||
tcontrols[1][0] = &tjoystick_right_wheel;
|
||||
|
Loading…
Reference in New Issue
Block a user