onepad: bring the sensibility changes over to onepad as well as onepad_legacy.

This commit is contained in:
Shanoah Alkire 2019-04-27 19:30:29 -07:00
parent ff9749f6dc
commit d00b8081ac
3 changed files with 24 additions and 14 deletions

View File

@ -263,9 +263,12 @@ bool JoystickInfo::TestForce(float strength = 0.60)
int JoystickInfo::GetInput(gamePadValues input)
{
float k = g_conf.get_sensibility() / 100.0; // convert sensibility to float
// Handle analog inputs which range from -32k to +32k. Range conversion is handled later in the controller
if (IsAnalogKey(input)) {
int value = SDL_GameControllerGetAxis(m_controller, (SDL_GameControllerAxis)m_pad_to_sdl[input]);
value *= k;
return (abs(value) > m_deadzone) ? value : 0;
}

View File

@ -63,7 +63,7 @@ public:
ftw = 1;
packed_options = 0;
ff_intensity = 0x7FFF; // set it at max value by default
sensibility = 500;
sensibility = 100;
for (int pad = 0; pad < GAMEPAD_NUMBER; pad++) {
keysym_map[pad].clear();
}
@ -105,15 +105,20 @@ public:
}
/**
* Set sensibility value, sensibility is not yet implemented(and will probably be after evdev)
* However, there will be an upper range too, less than 0 is an obvious wrong
* Anyway, we are doing object oriented code, members are definitely not supposed to be public
* Set sensibility value.
* There will be an upper range, and less than 0 is obviously wrong.
* We are doing object oriented code, so members are definitely not supposed to be public.
**/
void set_sensibility(u32 new_sensibility)
{
if (sensibility > 0) {
if (new_sensibility > 0)
{
sensibility = new_sensibility;
}
else
{
sensibility = 1;
}
}
u32 get_sensibility()

View File

@ -26,7 +26,7 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
wxID_ANY, // ID
_T("Gamepad configuration"), // Title
wxDefaultPosition, // Position
wxSize(400, 230), // Width + Lenght
wxSize(400, 270), // Width + Length
// Style
wxSYSTEM_MENU |
wxCAPTION |
@ -38,8 +38,8 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
m_pan_gamepad_config = new wxPanel(
this, // Parent
wxID_ANY, // ID
wxDefaultPosition, // Prosition
wxSize(300, 200) // Size
wxDefaultPosition, // Position
wxSize(300, 230) // Size
);
m_cb_rumble = new wxCheckBox(
m_pan_gamepad_config, // Parent
@ -75,7 +75,8 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
0, // min value 0x0000
0x7FFF, // max value 0x7FFF
wxPoint(150, 83), // Position
wxSize(200, 30) // Size
wxSize(200, 50), // Size
wxSL_HORIZONTAL | wxSL_LABELS | wxSL_BOTTOM
);
wxString txt_joystick = wxT("Joystick sensibility");
@ -83,7 +84,7 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
m_pan_gamepad_config, // Parent
wxID_ANY, // ID
txt_joystick, // Text which must be displayed
wxPoint(20, 120), // Position
wxPoint(20, 150), // Position
wxDefaultSize // Size
);
@ -92,16 +93,17 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
wxID_ANY, // ID
0, // value
0, // min value
100, // max value
wxPoint(150, 113), // Position
wxSize(200, 30) // Size
200, // max value
wxPoint(150, 143), // Position
wxSize(200, 50), // Size
wxSL_HORIZONTAL | wxSL_LABELS | wxSL_BOTTOM
);
m_bt_ok = new wxButton(
m_pan_gamepad_config, // Parent
wxID_ANY, // ID
_T("&OK"), // Label
wxPoint(320, 160), // Position
wxPoint(320, 210), // Position
wxSize(60, 25) // Size
);