Skip to content
Permalink
Browse files

onepad: bring the sensibility changes over to onepad as well as onepa…

…d_legacy.
  • Loading branch information...
arcum42 committed Apr 28, 2019
1 parent ff9749f commit d00b8081ac71b2b3ab05f2cf9230193b6af9eaa2
Showing with 24 additions and 14 deletions.
  1. +3 −0 plugins/onepad/SDL/joystick.cpp
  2. +10 −5 plugins/onepad/controller.h
  3. +11 −9 plugins/onepad/wx_dialog/GamepadConfiguration.cpp
@@ -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;
}

@@ -63,7 +63,7 @@ class PADconf
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 @@ class PADconf
}

/**
* 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()
@@ -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,15 +75,16 @@ 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");
m_lbl_rumble_intensity = new wxStaticText(
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
);

0 comments on commit d00b808

Please sign in to comment.
You can’t perform that action at this time.