SDL: Fix erratic analog pointer + control options
Fixes erratic speeds in analog pointer motion Implemented option to set analog/keyboard pointer speed and control the analog joystick deadzone. The deadzone option appears only if the build supports analog joystick (via JOY_ANALOG define)
This commit is contained in:
parent
085332a3dc
commit
45bd7a8b75
15 changed files with 353 additions and 53 deletions
|
@ -231,18 +231,59 @@ bool SdlEventSource::handleKbdMouse(Common::Event &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16 speedFactor = 25;
|
||||||
|
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureKbdMouseSpeed)) {
|
||||||
|
switch (ConfMan.getInt("kbdmouse_speed")) {
|
||||||
|
// 0.25 keyboard pointer speed
|
||||||
|
case 0:
|
||||||
|
speedFactor = 100;
|
||||||
|
break;
|
||||||
|
// 0.5 speed
|
||||||
|
case 1:
|
||||||
|
speedFactor = 50;
|
||||||
|
break;
|
||||||
|
// 0.75 speed
|
||||||
|
case 2:
|
||||||
|
speedFactor = 37;
|
||||||
|
break;
|
||||||
|
// 1.0 speed
|
||||||
|
case 3:
|
||||||
|
speedFactor = 25;
|
||||||
|
break;
|
||||||
|
// 1.25 speed
|
||||||
|
case 4:
|
||||||
|
speedFactor = 20;
|
||||||
|
break;
|
||||||
|
// 1.5 speed
|
||||||
|
case 5:
|
||||||
|
speedFactor = 17;
|
||||||
|
break;
|
||||||
|
// 1.75 speed
|
||||||
|
case 6:
|
||||||
|
speedFactor = 14;
|
||||||
|
break;
|
||||||
|
// 2.0 speed
|
||||||
|
case 7:
|
||||||
|
speedFactor = 12;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
speedFactor = 25;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// - The modifier key makes the mouse movement slower
|
// - The modifier key makes the mouse movement slower
|
||||||
// - The extra factor "delay/25" ensures velocities
|
// - The extra factor "delay/speedFactor" ensures velocities
|
||||||
// are independent of the kbdMouse update rate
|
// are independent of the kbdMouse update rate
|
||||||
// - all velocities were originally chosen
|
// - all velocities were originally chosen
|
||||||
// at a delay of 25, so that is the reference used here
|
// at a delay of 25, so that is the reference used here
|
||||||
// - note: operator order is important to avoid overflow
|
// - note: operator order is important to avoid overflow
|
||||||
if (_km.modifier) {
|
if (_km.modifier) {
|
||||||
_km.x += ((_km.x_vel / 10) * ((int16)_km.delay_time)) / 25;
|
_km.x += ((_km.x_vel / 10) * ((int16)_km.delay_time)) / speedFactor;
|
||||||
_km.y += ((_km.y_vel / 10) * ((int16)_km.delay_time)) / 25;
|
_km.y += ((_km.y_vel / 10) * ((int16)_km.delay_time)) / speedFactor;
|
||||||
} else {
|
} else {
|
||||||
_km.x += (_km.x_vel * ((int16)_km.delay_time)) / 25;
|
_km.x += (_km.x_vel * ((int16)_km.delay_time)) / speedFactor;
|
||||||
_km.y += (_km.y_vel * ((int16)_km.delay_time)) / 25;
|
_km.y += (_km.y_vel * ((int16)_km.delay_time)) / speedFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_km.x < 0) {
|
if (_km.x < 0) {
|
||||||
|
@ -826,8 +867,7 @@ bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
|
||||||
|
|
||||||
if (ev.jaxis.axis == JOY_XAXIS) {
|
if (ev.jaxis.axis == JOY_XAXIS) {
|
||||||
#ifdef JOY_ANALOG
|
#ifdef JOY_ANALOG
|
||||||
_km.x_vel = axis / vel_to_axis;
|
_km.joy_x = axis;
|
||||||
_km.x_down_count = 0;
|
|
||||||
#else
|
#else
|
||||||
if (axis != 0) {
|
if (axis != 0) {
|
||||||
_km.x_vel = (axis > 0) ? 1 * MULTIPLIER:-1 * MULTIPLIER;
|
_km.x_vel = (axis > 0) ? 1 * MULTIPLIER:-1 * MULTIPLIER;
|
||||||
|
@ -842,8 +882,7 @@ bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
|
||||||
axis = -axis;
|
axis = -axis;
|
||||||
#endif
|
#endif
|
||||||
#ifdef JOY_ANALOG
|
#ifdef JOY_ANALOG
|
||||||
_km.y_vel = -axis / vel_to_axis;
|
_km.joy_y = -axis;
|
||||||
_km.y_down_count = 0;
|
|
||||||
#else
|
#else
|
||||||
if (axis != 0) {
|
if (axis != 0) {
|
||||||
_km.y_vel = (-axis > 0) ? 1 * MULTIPLIER: -1 * MULTIPLIER;
|
_km.y_vel = (-axis > 0) ? 1 * MULTIPLIER: -1 * MULTIPLIER;
|
||||||
|
@ -856,21 +895,25 @@ bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
|
||||||
}
|
}
|
||||||
#ifdef JOY_ANALOG
|
#ifdef JOY_ANALOG
|
||||||
// radial and scaled analog joystick deadzone
|
// radial and scaled analog joystick deadzone
|
||||||
float analogX = (float) (_km.x_vel * vel_to_axis);
|
float analogX = (float)_km.joy_x;
|
||||||
float analogY = (float) (_km.y_vel * vel_to_axis);
|
float analogY = (float)_km.joy_y;
|
||||||
float deadZone = (float) JOY_DEADZONE;
|
float deadZone = (float)JOY_DEADZONE;
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureJoystickDeadzone))
|
||||||
|
deadZone = (float)ConfMan.getInt("joystick_deadzone") * 1000.0f;
|
||||||
float scalingFactor = 1.0f;
|
float scalingFactor = 1.0f;
|
||||||
float magnitude = 0.0f;
|
float magnitude = 0.0f;
|
||||||
|
|
||||||
magnitude = sqrt(analogX * analogX + analogY * analogY);
|
magnitude = sqrt(analogX * analogX + analogY * analogY);
|
||||||
|
|
||||||
if (magnitude >= deadZone) {
|
if (magnitude >= deadZone) {
|
||||||
|
_km.x_down_count = 0;
|
||||||
|
_km.y_down_count = 0;
|
||||||
scalingFactor = 1.0f / magnitude * (magnitude - deadZone) / (32769.0f - deadZone);
|
scalingFactor = 1.0f / magnitude * (magnitude - deadZone) / (32769.0f - deadZone);
|
||||||
_km.x_vel = (int16) (analogX * scalingFactor * 32768.0f / vel_to_axis);
|
_km.x_vel = (int16)(analogX * scalingFactor * 32768.0f / vel_to_axis);
|
||||||
_km.y_vel = (int16) (analogY * scalingFactor * 32768.0f / vel_to_axis);
|
_km.y_vel = (int16)(analogY * scalingFactor * 32768.0f / vel_to_axis);
|
||||||
} else {
|
} else {
|
||||||
_km.y_vel = 0;
|
|
||||||
_km.x_vel = 0;
|
_km.x_vel = 0;
|
||||||
|
_km.y_vel = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -951,6 +994,8 @@ void SdlEventSource::resetKeyboardEmulation(int16 x_max, int16 y_max) {
|
||||||
_km.delay_time = 12;
|
_km.delay_time = 12;
|
||||||
_km.last_time = 0;
|
_km.last_time = 0;
|
||||||
_km.modifier = false;
|
_km.modifier = false;
|
||||||
|
_km.joy_x = 0;
|
||||||
|
_km.joy_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SdlEventSource::handleResizeEvent(Common::Event &event, int w, int h) {
|
bool SdlEventSource::handleResizeEvent(Common::Event &event, int w, int h) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ protected:
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
struct KbdMouse {
|
struct KbdMouse {
|
||||||
int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
|
int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count, joy_x, joy_y;
|
||||||
uint32 last_time, delay_time, x_down_time, y_down_time;
|
uint32 last_time, delay_time, x_down_time, y_down_time;
|
||||||
bool modifier;
|
bool modifier;
|
||||||
};
|
};
|
||||||
|
|
|
@ -179,6 +179,10 @@ bool OSystem_SDL::hasFeature(Feature f) {
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
if (f == kFeatureClipboardSupport) return true;
|
if (f == kFeatureClipboardSupport) return true;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef JOY_ANALOG
|
||||||
|
if (f == kFeatureJoystickDeadzone) return true;
|
||||||
|
#endif
|
||||||
|
if (f == kFeatureKbdMouseSpeed) return true;
|
||||||
return ModularBackend::hasFeature(f);
|
return ModularBackend::hasFeature(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +278,16 @@ void OSystem_SDL::initBackend() {
|
||||||
|
|
||||||
_inited = true;
|
_inited = true;
|
||||||
|
|
||||||
|
if (!ConfMan.hasKey("kbdmouse_speed")) {
|
||||||
|
ConfMan.registerDefault("kbdmouse_speed", 3);
|
||||||
|
ConfMan.setInt("kbdmouse_speed", 3);
|
||||||
|
}
|
||||||
|
#ifdef JOY_ANALOG
|
||||||
|
if (!ConfMan.hasKey("joystick_deadzone")) {
|
||||||
|
ConfMan.registerDefault("joystick_deadzone", 3);
|
||||||
|
ConfMan.setInt("joystick_deadzone", 3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ModularBackend::initBackend();
|
ModularBackend::initBackend();
|
||||||
|
|
||||||
// We have to initialize the graphics manager before the event manager
|
// We have to initialize the graphics manager before the event manager
|
||||||
|
|
|
@ -351,7 +351,18 @@ public:
|
||||||
/**
|
/**
|
||||||
* swap menu and back buttons
|
* swap menu and back buttons
|
||||||
*/
|
*/
|
||||||
kFeatureSwapMenuAndBackButtons
|
kFeatureSwapMenuAndBackButtons,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* keyboard mouse and joystick mouse speed
|
||||||
|
*/
|
||||||
|
kFeatureKbdMouseSpeed,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* change analog joystick deadzone
|
||||||
|
*/
|
||||||
|
kFeatureJoystickDeadzone
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
117
gui/options.cpp
117
gui/options.cpp
|
@ -78,7 +78,9 @@ enum {
|
||||||
kExtraPathClearCmd = 'clex',
|
kExtraPathClearCmd = 'clex',
|
||||||
kChoosePluginsDirCmd = 'chpl',
|
kChoosePluginsDirCmd = 'chpl',
|
||||||
kChooseThemeCmd = 'chtf',
|
kChooseThemeCmd = 'chtf',
|
||||||
kUpdatesCheckCmd = 'updc'
|
kUpdatesCheckCmd = 'updc',
|
||||||
|
kKbdMouseSpeedChanged = 'kmsc',
|
||||||
|
kJoystickDeadzoneChanged= 'jodc'
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -120,6 +122,8 @@ static const char *savePeriodLabels[] = { _s("Never"), _s("every 5 mins"), _s("e
|
||||||
static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 };
|
static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 };
|
||||||
static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11 kHz"), _s("22 kHz"), _s("44 kHz"), _s("48 kHz"), 0 };
|
static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11 kHz"), _s("22 kHz"), _s("44 kHz"), _s("48 kHz"), 0 };
|
||||||
static const int outputRateValues[] = { 0, 8000, 11025, 22050, 44100, 48000, -1 };
|
static const int outputRateValues[] = { 0, 8000, 11025, 22050, 44100, 48000, -1 };
|
||||||
|
static const char *kbdMouseSpeedLabels[] = { _s("3"), _s("5"), _s("8"), _s("10"), _s("13"), _s("15"), _s("18"), _s("20"), 0 };
|
||||||
|
static const int kbdMouseSpeedValues[] = { 0, 1, 2, 3, 4, 5, 6, 7, -1 };
|
||||||
|
|
||||||
OptionsDialog::OptionsDialog(const Common::String &domain, int x, int y, int w, int h)
|
OptionsDialog::OptionsDialog(const Common::String &domain, int x, int y, int w, int h)
|
||||||
: Dialog(x, y, w, h), _domain(domain), _graphicsTabId(-1), _midiTabId(-1), _pathsTabId(-1), _tabWidget(0) {
|
: Dialog(x, y, w, h), _domain(domain), _graphicsTabId(-1), _midiTabId(-1), _pathsTabId(-1), _tabWidget(0) {
|
||||||
|
@ -140,6 +144,12 @@ void OptionsDialog::init() {
|
||||||
_onscreenCheckbox = 0;
|
_onscreenCheckbox = 0;
|
||||||
_touchpadCheckbox = 0;
|
_touchpadCheckbox = 0;
|
||||||
_swapMenuAndBackBtnsCheckbox = 0;
|
_swapMenuAndBackBtnsCheckbox = 0;
|
||||||
|
_kbdMouseSpeedDesc = 0;
|
||||||
|
_kbdMouseSpeedSlider = 0;
|
||||||
|
_kbdMouseSpeedLabel = 0;
|
||||||
|
_joystickDeadzoneDesc = 0;
|
||||||
|
_joystickDeadzoneSlider = 0;
|
||||||
|
_joystickDeadzoneLabel = 0;
|
||||||
_enableGraphicSettings = false;
|
_enableGraphicSettings = false;
|
||||||
_gfxPopUp = 0;
|
_gfxPopUp = 0;
|
||||||
_gfxPopUpDesc = 0;
|
_gfxPopUpDesc = 0;
|
||||||
|
@ -229,6 +239,24 @@ void OptionsDialog::build() {
|
||||||
_swapMenuAndBackBtnsCheckbox->setState(state);
|
_swapMenuAndBackBtnsCheckbox->setState(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureKbdMouseSpeed)) {
|
||||||
|
if (ConfMan.hasKey("kbdmouse_speed", _domain)) {
|
||||||
|
int value = ConfMan.getInt("kbdmouse_speed", _domain);
|
||||||
|
if (_kbdMouseSpeedSlider && value < sizeof(kbdMouseSpeedLabels)) {
|
||||||
|
_kbdMouseSpeedSlider->setValue(value);
|
||||||
|
_kbdMouseSpeedLabel->setLabel(kbdMouseSpeedLabels[value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureJoystickDeadzone)) {
|
||||||
|
if (ConfMan.hasKey("joystick_deadzone", _domain)) {
|
||||||
|
int value = ConfMan.getInt("joystick_deadzone", _domain);
|
||||||
|
if (_joystickDeadzoneSlider != 0) {
|
||||||
|
_joystickDeadzoneSlider->setValue(value);
|
||||||
|
_joystickDeadzoneLabel->setValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Graphic options
|
// Graphic options
|
||||||
if (_fullscreenCheckbox) {
|
if (_fullscreenCheckbox) {
|
||||||
|
@ -424,6 +452,16 @@ void OptionsDialog::apply() {
|
||||||
g_system->setFeatureState(OSystem::kFeatureSwapMenuAndBackButtons, _swapMenuAndBackBtnsCheckbox->getState());
|
g_system->setFeatureState(OSystem::kFeatureSwapMenuAndBackButtons, _swapMenuAndBackBtnsCheckbox->getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureKbdMouseSpeed)) {
|
||||||
|
if (ConfMan.getInt("kbdmouse_speed", _domain) != _kbdMouseSpeedSlider->getValue()) {
|
||||||
|
ConfMan.setInt("kbdmouse_speed", _kbdMouseSpeedSlider->getValue(), _domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureJoystickDeadzone)) {
|
||||||
|
if (ConfMan.getInt("joystick_deadzone", _domain) != _joystickDeadzoneSlider->getValue()) {
|
||||||
|
ConfMan.setInt("joystick_deadzone", _joystickDeadzoneSlider->getValue(), _domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Graphic options
|
// Graphic options
|
||||||
|
@ -737,6 +775,14 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
|
||||||
_soundFontClearButton->setEnabled(false);
|
_soundFontClearButton->setEnabled(false);
|
||||||
draw();
|
draw();
|
||||||
break;
|
break;
|
||||||
|
case kKbdMouseSpeedChanged:
|
||||||
|
_kbdMouseSpeedLabel->setLabel(kbdMouseSpeedLabels[_kbdMouseSpeedSlider->getValue()]);
|
||||||
|
_kbdMouseSpeedLabel->draw();
|
||||||
|
break;
|
||||||
|
case kJoystickDeadzoneChanged:
|
||||||
|
_joystickDeadzoneLabel->setValue(_joystickDeadzoneSlider->getValue());
|
||||||
|
_joystickDeadzoneLabel->draw();
|
||||||
|
break;
|
||||||
case kApplyCmd:
|
case kApplyCmd:
|
||||||
apply();
|
apply();
|
||||||
break;
|
break;
|
||||||
|
@ -878,22 +924,47 @@ void OptionsDialog::setSubtitleSettingsState(bool enabled) {
|
||||||
_subSpeedLabel->setEnabled(ena);
|
_subSpeedLabel->setEnabled(ena);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::addControlControls(GuiObject *boss, const Common::String &prefix) {
|
void OptionsDialog::addControlControls(GuiObject *boss, const Common::String &prefix) {
|
||||||
// Show On-Screen control
|
// Show On-Screen control
|
||||||
if (g_system->hasFeature(OSystem::kFeatureOnScreenControl))
|
if (g_system->hasFeature(OSystem::kFeatureOnScreenControl))
|
||||||
_onscreenCheckbox = new CheckboxWidget(boss, prefix + "grOnScreenCheckbox", _("Show On-screen control"));
|
_onscreenCheckbox = new CheckboxWidget(boss, prefix + "grOnScreenCheckbox", _("Show On-screen control"));
|
||||||
|
|
||||||
// Touchpad Mouse mode
|
|
||||||
if (g_system->hasFeature(OSystem::kFeatureTouchpadMode))
|
|
||||||
_touchpadCheckbox = new CheckboxWidget(boss, prefix + "grTouchpadCheckbox", _("Touchpad mouse mode"));
|
|
||||||
|
|
||||||
// Swap menu and back buttons
|
// Touchpad Mouse mode
|
||||||
if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons))
|
if (g_system->hasFeature(OSystem::kFeatureTouchpadMode))
|
||||||
_swapMenuAndBackBtnsCheckbox = new CheckboxWidget(boss, prefix + "grSwapMenuAndBackBtnsCheckbox", _("Swap Menu and Back buttons"));
|
_touchpadCheckbox = new CheckboxWidget(boss, prefix + "grTouchpadCheckbox", _("Touchpad mouse mode"));
|
||||||
|
|
||||||
_enableControlSettings = true;
|
// Swap menu and back buttons
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons))
|
||||||
|
_swapMenuAndBackBtnsCheckbox = new CheckboxWidget(boss, prefix + "grSwapMenuAndBackBtnsCheckbox", _("Swap Menu and Back buttons"));
|
||||||
|
|
||||||
|
// Keyboard and joystick mouse speed
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureKbdMouseSpeed)) {
|
||||||
|
if (g_system->getOverlayWidth() > 320)
|
||||||
|
_kbdMouseSpeedDesc = new StaticTextWidget(boss, prefix + "grKbdMouseSpeedDesc", _("Mouse Speed:"), _("Speed multiplier for mouse emulation"));
|
||||||
|
else
|
||||||
|
_kbdMouseSpeedDesc = new StaticTextWidget(boss, prefix + "grKbdMouseSpeedDesc", _c("Mouse Speed:", "lowres"), _("Speed multiplier for mouse emulation"));
|
||||||
|
_kbdMouseSpeedSlider = new SliderWidget(boss, prefix + "grKbdMouseSpeedSlider", _("Speed multiplier for mouse emulation"), kKbdMouseSpeedChanged);
|
||||||
|
_kbdMouseSpeedLabel = new StaticTextWidget(boss, prefix + "grKbdMouseSpeedLabel", " ");
|
||||||
|
_kbdMouseSpeedSlider->setMinValue(0);
|
||||||
|
_kbdMouseSpeedSlider->setMaxValue(7);
|
||||||
|
_kbdMouseSpeedLabel->setFlags(WIDGET_CLEARBG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Joystick deadzone
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureJoystickDeadzone)) {
|
||||||
|
if (g_system->getOverlayWidth() > 320)
|
||||||
|
_joystickDeadzoneDesc = new StaticTextWidget(boss, prefix + "grJoystickDeadzoneDesc", _("Joy Deadzone:"), _("Analog Joystick Deadzone"));
|
||||||
|
else
|
||||||
|
_joystickDeadzoneDesc = new StaticTextWidget(boss, prefix + "grJoystickDeadzoneDesc", _c("Joy Deadzone:", "lowres"), _("Analog Joystick Deadzone"));
|
||||||
|
_joystickDeadzoneSlider = new SliderWidget(boss, prefix + "grJoystickDeadzoneSlider", _("Analog Joystick Deadzone"), kJoystickDeadzoneChanged);
|
||||||
|
_joystickDeadzoneLabel = new StaticTextWidget(boss, prefix + "grJoystickDeadzoneLabel", " ");
|
||||||
|
_joystickDeadzoneSlider->setMinValue(1);
|
||||||
|
_joystickDeadzoneSlider->setMaxValue(10);
|
||||||
|
_joystickDeadzoneLabel->setFlags(WIDGET_CLEARBG);
|
||||||
|
}
|
||||||
|
_enableControlSettings = true;
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &prefix) {
|
void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &prefix) {
|
||||||
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
|
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
|
||||||
Common::String context;
|
Common::String context;
|
||||||
|
@ -1343,14 +1414,16 @@ void GlobalOptionsDialog::build() {
|
||||||
TabWidget *tab = new TabWidget(this, "GlobalOptions.TabWidget");
|
TabWidget *tab = new TabWidget(this, "GlobalOptions.TabWidget");
|
||||||
|
|
||||||
//
|
//
|
||||||
// The control tab (currently visible only for AndroidSDL platform, visibility checking by features
|
// The control tab (currently visible only for AndroidSDL, SDL, and Vita platform, visibility checking by features
|
||||||
//
|
//
|
||||||
if (g_system->hasFeature(OSystem::kFeatureTouchpadMode) ||
|
if (g_system->hasFeature(OSystem::kFeatureTouchpadMode) ||
|
||||||
g_system->hasFeature(OSystem::kFeatureOnScreenControl) ||
|
g_system->hasFeature(OSystem::kFeatureOnScreenControl) ||
|
||||||
g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) {
|
g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons) ||
|
||||||
|
g_system->hasFeature(OSystem::kFeatureKbdMouseSpeed) ||
|
||||||
|
g_system->hasFeature(OSystem::kFeatureJoystickDeadzone)) {
|
||||||
tab->addTab(_("Control"));
|
tab->addTab(_("Control"));
|
||||||
addControlControls(tab, "GlobalOptions_Control.");
|
addControlControls(tab, "GlobalOptions_Control.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 1) The graphics tab
|
// 1) The graphics tab
|
||||||
|
@ -1927,8 +2000,14 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
#ifdef USE_LIBCURL
|
#ifdef USE_LIBCURL
|
||||||
case kPopUpItemSelectedCmd:
|
case kPopUpItemSelectedCmd:
|
||||||
{
|
{
|
||||||
//update container's scrollbar
|
//update container's scrollbar and make sure tabs are not re-arranged
|
||||||
reflowLayout();
|
if (_tabWidget) {
|
||||||
|
int oldFirstVisible = _tabWidget->getFirstVisible();
|
||||||
|
reflowLayout();
|
||||||
|
_tabWidget->setFirstVisible(oldFirstVisible);
|
||||||
|
} else {
|
||||||
|
reflowLayout();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kConfigureStorageCmd:
|
case kConfigureStorageCmd:
|
||||||
|
|
|
@ -123,7 +123,14 @@ private:
|
||||||
CheckboxWidget *_touchpadCheckbox;
|
CheckboxWidget *_touchpadCheckbox;
|
||||||
CheckboxWidget *_onscreenCheckbox;
|
CheckboxWidget *_onscreenCheckbox;
|
||||||
CheckboxWidget *_swapMenuAndBackBtnsCheckbox;
|
CheckboxWidget *_swapMenuAndBackBtnsCheckbox;
|
||||||
|
|
||||||
|
StaticTextWidget *_kbdMouseSpeedDesc;
|
||||||
|
SliderWidget *_kbdMouseSpeedSlider;
|
||||||
|
StaticTextWidget *_kbdMouseSpeedLabel;
|
||||||
|
StaticTextWidget *_joystickDeadzoneDesc;
|
||||||
|
SliderWidget *_joystickDeadzoneSlider;
|
||||||
|
StaticTextWidget *_joystickDeadzoneLabel;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Graphics controls
|
// Graphics controls
|
||||||
//
|
//
|
||||||
|
|
|
@ -813,17 +813,39 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</dialog>"
|
"</dialog>"
|
||||||
"<dialog name='GlobalOptions_Control' overlays='Dialog.GlobalOptions.TabWidget'>"
|
"<dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'>"
|
||||||
"<layout type='vertical' padding='16,16,16,16' spacing='8'>"
|
"<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>"
|
||||||
"<widget name='grOnScreenCheckbox' "
|
"<widget name = 'grOnScreenCheckbox' "
|
||||||
"type='Checkbox' "
|
"type = 'Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
"<widget name='grTouchpadCheckbox' "
|
"<widget name = 'grTouchpadCheckbox' "
|
||||||
"type='Checkbox' "
|
"type = 'Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
"<widget name='grSwapMenuAndBackBtnsCheckbox' "
|
"<widget name = 'grSwapMenuAndBackBtnsCheckbox' "
|
||||||
"type='Checkbox' "
|
"type = 'Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
|
"<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>"
|
||||||
|
"<widget name = 'grKbdMouseSpeedDesc' "
|
||||||
|
"type = 'OptionsLabel' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grKbdMouseSpeedSlider' "
|
||||||
|
"type = 'Slider' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grKbdMouseSpeedLabel' "
|
||||||
|
"type = 'SmallLabel' "
|
||||||
|
"/>"
|
||||||
|
"</layout>"
|
||||||
|
"<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>"
|
||||||
|
"<widget name = 'grJoystickDeadzoneDesc' "
|
||||||
|
"type = 'OptionsLabel' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grJoystickDeadzoneSlider' "
|
||||||
|
"type = 'Slider' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grJoystickDeadzoneLabel' "
|
||||||
|
"type = 'SmallLabel' "
|
||||||
|
"/>"
|
||||||
|
"</layout>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</dialog>"
|
"</dialog>"
|
||||||
"<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>"
|
"<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>"
|
||||||
|
@ -2368,17 +2390,39 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</dialog>"
|
"</dialog>"
|
||||||
"<dialog name='GlobalOptions_Control' overlays='Dialog.GlobalOptions.TabWidget'>"
|
"<dialog name = 'GlobalOptions_Control' overlays = 'Dialog.GlobalOptions.TabWidget'>"
|
||||||
"<layout type='vertical' padding='16,16,16,16' spacing='6'>"
|
"<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>"
|
||||||
"<widget name='grOnScreenCheckbox' "
|
"<widget name = 'grOnScreenCheckbox' "
|
||||||
"type='Checkbox' "
|
"type = 'Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
"<widget name='grTouchpadCheckbox' "
|
"<widget name = 'grTouchpadCheckbox' "
|
||||||
"type='Checkbox' "
|
"type = 'Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
"<widget name='grSwapMenuAndBackBtnsCheckbox' "
|
"<widget name = 'grSwapMenuAndBackBtnsCheckbox' "
|
||||||
"type='Checkbox' "
|
"type = 'Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
|
"<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>"
|
||||||
|
"<widget name = 'grKbdMouseSpeedDesc' "
|
||||||
|
"type = 'OptionsLabel' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grKbdMouseSpeedSlider' "
|
||||||
|
"type = 'Slider' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grKbdMouseSpeedLabel' "
|
||||||
|
"type = 'SmallLabel' "
|
||||||
|
"/>"
|
||||||
|
"</layout>"
|
||||||
|
"<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>"
|
||||||
|
"<widget name = 'grJoystickDeadzoneDesc' "
|
||||||
|
"type = 'OptionsLabel' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grJoystickDeadzoneSlider' "
|
||||||
|
"type = 'Slider' "
|
||||||
|
"/>"
|
||||||
|
"<widget name = 'grJoystickDeadzoneLabel' "
|
||||||
|
"type = 'SmallLabel' "
|
||||||
|
"/>"
|
||||||
|
"</layout>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</dialog>"
|
"</dialog>"
|
||||||
"<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>"
|
"<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>"
|
||||||
|
|
Binary file not shown.
|
@ -249,6 +249,28 @@
|
||||||
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
||||||
|
<widget name = 'grKbdMouseSpeedDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
|
<widget name = 'grJoystickDeadzoneDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,28 @@
|
||||||
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
||||||
|
<widget name = 'grKbdMouseSpeedDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
|
<widget name = 'grJoystickDeadzoneDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -263,6 +263,28 @@
|
||||||
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
||||||
|
<widget name = 'grKbdMouseSpeedDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
|
<widget name = 'grJoystickDeadzoneDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
|
@ -244,6 +244,28 @@
|
||||||
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
<widget name = 'grSwapMenuAndBackBtnsCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
||||||
|
<widget name = 'grKbdMouseSpeedDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grKbdMouseSpeedLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
|
<widget name = 'grJoystickDeadzoneDesc'
|
||||||
|
type = 'OptionsLabel'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneSlider'
|
||||||
|
type = 'Slider'
|
||||||
|
/>
|
||||||
|
<widget name = 'grJoystickDeadzoneLabel'
|
||||||
|
type = 'SmallLabel'
|
||||||
|
/>
|
||||||
|
</layout>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
|
@ -277,6 +277,16 @@ void TabWidget::adjustTabs(int value) {
|
||||||
setActiveTab(tabID);
|
setActiveTab(tabID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TabWidget::getFirstVisible() {
|
||||||
|
return _firstVisibleTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabWidget::setFirstVisible(int tabID) {
|
||||||
|
assert(0 <= tabID && tabID < (int)_tabs.size());
|
||||||
|
_firstVisibleTab = tabID;
|
||||||
|
_boss->draw();
|
||||||
|
}
|
||||||
|
|
||||||
void TabWidget::reflowLayout() {
|
void TabWidget::reflowLayout() {
|
||||||
Widget::reflowLayout();
|
Widget::reflowLayout();
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,8 @@ public:
|
||||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
virtual bool handleKeyDown(Common::KeyState state);
|
virtual bool handleKeyDown(Common::KeyState state);
|
||||||
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||||
|
virtual int getFirstVisible();
|
||||||
|
virtual void setFirstVisible(int tabID);
|
||||||
|
|
||||||
virtual void reflowLayout();
|
virtual void reflowLayout();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue