mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Added controller sensitivity option, merged cursor options
This commit is contained in:
parent
1020477b6e
commit
7ebc3bc6a5
@ -31,10 +31,8 @@ InputSourceGameController::InputSourceGameController():
|
||||
configTriggerTreshold(settings["input"]["controllerTriggerTreshold"].Float()),
|
||||
configAxisDeadZone(settings["input"]["controllerAxisDeadZone"].Float()),
|
||||
configAxisFullZone(settings["input"]["controllerAxisFullZone"].Float()),
|
||||
configPointerSpeed(settings["input"]["controllerPointerSpeed"].Float()),
|
||||
configPointerScale(settings["input"]["controllerPointerScale"].Float()),
|
||||
configPanningSpeed(settings["input"]["controllerPanningSpeed"].Float()),
|
||||
configPanningScale(settings["input"]["controllerPanningScale"].Float()),
|
||||
configAxisSpeed(settings["input"]["controllerAxisSpeed"].Float()),
|
||||
configAxisScale(settings["input"]["controllerAxisScale"].Float()),
|
||||
cursorAxisValueX(0),
|
||||
cursorAxisValueY(0),
|
||||
cursorPlanDisX(0.0),
|
||||
@ -274,12 +272,12 @@ void InputSourceGameController::handleCursorUpdate(int32_t deltaTimeMs)
|
||||
if(vstd::isAlmostZero(cursorAxisValueX))
|
||||
cursorPlanDisX = 0;
|
||||
else
|
||||
cursorPlanDisX += deltaTimeSeconds * configPointerSpeed * scaleAxis(cursorAxisValueX, configPointerScale);
|
||||
cursorPlanDisX += deltaTimeSeconds * configAxisSpeed * scaleAxis(cursorAxisValueX, configAxisScale);
|
||||
|
||||
if (vstd::isAlmostZero(cursorAxisValueY))
|
||||
cursorPlanDisY = 0;
|
||||
else
|
||||
cursorPlanDisY += deltaTimeSeconds * configPointerSpeed * scaleAxis(cursorAxisValueY, configPointerScale);
|
||||
cursorPlanDisY += deltaTimeSeconds * configAxisSpeed * scaleAxis(cursorAxisValueY, configAxisScale);
|
||||
|
||||
int moveDisX = getMoveDis(cursorPlanDisX);
|
||||
int moveDisY = getMoveDis(cursorPlanDisY);
|
||||
@ -308,8 +306,8 @@ void InputSourceGameController::handleScrollUpdate(int32_t deltaTimeMs)
|
||||
return;
|
||||
}
|
||||
float deltaTimeSeconds = static_cast<float>(deltaTimeMs) / 1000;
|
||||
scrollPlanDisX += deltaTimeSeconds * configPanningSpeed * scaleAxis(scrollAxisValueX, configPanningScale);
|
||||
scrollPlanDisY += deltaTimeSeconds * configPanningSpeed * scaleAxis(scrollAxisValueY, configPanningScale);
|
||||
scrollPlanDisX += deltaTimeSeconds * configAxisSpeed * scaleAxis(scrollAxisValueX, configAxisScale);
|
||||
scrollPlanDisY += deltaTimeSeconds * configAxisSpeed * scaleAxis(scrollAxisValueY, configAxisScale);
|
||||
int moveDisX = getMoveDis(scrollPlanDisX);
|
||||
int moveDisY = getMoveDis(scrollPlanDisY);
|
||||
if(moveDisX != 0 || moveDisY != 0)
|
||||
|
@ -42,10 +42,8 @@ class InputSourceGameController
|
||||
const double configTriggerTreshold;
|
||||
const double configAxisDeadZone;
|
||||
const double configAxisFullZone;
|
||||
const double configPointerSpeed;
|
||||
const double configPointerScale;
|
||||
const double configPanningSpeed;
|
||||
const double configPanningScale;
|
||||
const double configAxisSpeed;
|
||||
const double configAxisScale;
|
||||
|
||||
void openGameController(int index);
|
||||
int getJoystickIndex(SDL_GameController * controller);
|
||||
|
@ -247,10 +247,8 @@
|
||||
"controllerTriggerTreshold",
|
||||
"controllerAxisDeadZone",
|
||||
"controllerAxisFullZone",
|
||||
"controllerPointerSpeed",
|
||||
"controllerPointerScale",
|
||||
"controllerPanningSpeed",
|
||||
"controllerPanningScale",
|
||||
"controllerAxisSpeed",
|
||||
"controllerAxisScale"
|
||||
],
|
||||
"properties" : {
|
||||
"radialWheelGarrisonSwipe" : {
|
||||
@ -293,19 +291,11 @@
|
||||
"type" : "number",
|
||||
"default" : 1.0
|
||||
},
|
||||
"controllerPointerSpeed" : {
|
||||
"controllerAxisSpeed" : {
|
||||
"type" : "number",
|
||||
"default" : 1000
|
||||
},
|
||||
"controllerPointerScale" : {
|
||||
"type" : "number",
|
||||
"default" : 2
|
||||
},
|
||||
"controllerPanningSpeed" : {
|
||||
"type" : "number",
|
||||
"default" : 1000
|
||||
},
|
||||
"controllerPanningScale" : {
|
||||
"controllerAxisScale" : {
|
||||
"type" : "number",
|
||||
"default" : 2
|
||||
}
|
||||
|
@ -78,13 +78,9 @@ void CSettingsView::loadSettings()
|
||||
#ifdef VCMI_MOBILE
|
||||
ui->comboBoxFullScreen->hide();
|
||||
ui->labelFullScreen->hide();
|
||||
ui->labelCursorTypeDesktop->hide();
|
||||
ui->comboBoxCursorTypeDesktop->hide();
|
||||
#else
|
||||
ui->labelReservedArea->hide();
|
||||
ui->sliderReservedArea->hide();
|
||||
ui->labelCursorTypeMobile->hide();
|
||||
ui->comboBoxCursorTypeMobile->hide();
|
||||
ui->comboBoxRelativeCursorMode->hide();
|
||||
ui->sliderRelativeCursorSpeed->hide();
|
||||
if (settings["video"]["realFullscreen"].Bool())
|
||||
@ -136,8 +132,7 @@ void CSettingsView::loadSettings()
|
||||
|
||||
std::string cursorType = settings["video"]["cursor"].String();
|
||||
int cursorTypeIndex = vstd::find_pos(cursorTypesList, cursorType);
|
||||
ui->comboBoxCursorTypeDesktop->setCurrentIndex(cursorTypeIndex);
|
||||
ui->comboBoxCursorTypeMobile->setCurrentIndex(cursorTypeIndex);
|
||||
ui->comboBoxCursorType->setCurrentIndex(cursorTypeIndex);
|
||||
|
||||
std::string upscalingFilter = settings["video"]["scalingMode"].String();
|
||||
int upscalingFilterIndex = vstd::find_pos(upscalingFilterTypes, upscalingFilter);
|
||||
@ -152,6 +147,8 @@ void CSettingsView::loadSettings()
|
||||
ui->slideToleranceDistanceMouse->setValue(settings["input"]["mouseToleranceDistance"].Integer());
|
||||
ui->sliderToleranceDistanceTouch->setValue(settings["input"]["touchToleranceDistance"].Integer());
|
||||
ui->sliderToleranceDistanceController->setValue(settings["input"]["shortcutToleranceDistance"].Integer());
|
||||
ui->sliderControllerSticksSensitivity->setValue(settings["input"]["controllerAxisSpeed"].Integer());
|
||||
ui->sliderControllerSticksAcceleration->setValue(settings["input"]["controllerAxisScale"].Float() * 100);
|
||||
ui->lineEditGameLobbyHost->setText(QString::fromStdString(settings["lobby"]["hostname"].String()));
|
||||
ui->spinBoxNetworkPortLobby->setValue(settings["lobby"]["port"].Integer());
|
||||
}
|
||||
@ -424,13 +421,7 @@ void CSettingsView::showEvent(QShowEvent * event)
|
||||
QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void CSettingsView::on_comboBoxCursorTypeDesktop_currentIndexChanged(int index)
|
||||
{
|
||||
Settings node = settings.write["video"]["cursor"];
|
||||
node->String() = cursorTypesList[index];
|
||||
}
|
||||
|
||||
void CSettingsView::on_comboBoxCursorTypeMobile_currentIndexChanged(int index)
|
||||
void CSettingsView::on_comboBoxCursorType_currentIndexChanged(int index)
|
||||
{
|
||||
Settings node = settings.write["video"]["cursor"];
|
||||
node->String() = cursorTypesList[index];
|
||||
@ -677,3 +668,15 @@ void CSettingsView::on_spinBoxNetworkPortLobby_valueChanged(int arg1)
|
||||
Settings node = settings.write["lobby"]["port"];
|
||||
node->Integer() = arg1;
|
||||
}
|
||||
|
||||
void CSettingsView::on_sliderControllerSticksAcceleration_valueChanged(int value)
|
||||
{
|
||||
Settings node = settings.write["input"]["configAxisScale"];
|
||||
node->Integer() = value / 100.0;
|
||||
}
|
||||
|
||||
void CSettingsView::on_sliderControllerSticksSensitivity_valueChanged(int value)
|
||||
{
|
||||
Settings node = settings.write["input"]["configAxisSpeed"];
|
||||
node->Integer() = value;
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ private slots:
|
||||
void on_comboBoxDisplayIndex_currentIndexChanged(int index);
|
||||
void on_comboBoxAutoSave_currentIndexChanged(int index);
|
||||
void on_comboBoxLanguage_currentIndexChanged(int index);
|
||||
void on_comboBoxCursorTypeMobile_currentIndexChanged(int index);
|
||||
void on_comboBoxCursorTypeDesktop_currentIndexChanged(int index);
|
||||
void on_comboBoxCursorType_currentIndexChanged(int index);
|
||||
void on_pushButtonTranslation_clicked();
|
||||
void on_checkBoxRepositoryDefault_stateChanged(int arg1);
|
||||
void on_checkBoxRepositoryExtra_stateChanged(int arg1);
|
||||
@ -75,6 +74,10 @@ private slots:
|
||||
void on_lineEditGameLobbyHost_textChanged(const QString &arg1);
|
||||
void on_spinBoxNetworkPortLobby_valueChanged(int arg1);
|
||||
|
||||
void on_sliderControllerSticksAcceleration_valueChanged(int value);
|
||||
|
||||
void on_sliderControllerSticksSensitivity_valueChanged(int value);
|
||||
|
||||
private:
|
||||
Ui::CSettingsView * ui;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user