Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add right analog for touch controls. #12182

Merged
merged 2 commits into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ static ConfigSetting controlSettings[] = {
ConfigSetting("LKeyX", "LKeyY", "LKeyScale", "ShowTouchLTrigger", &g_Config.touchLKey, defaultTouchPosShow, true, true),
ConfigSetting("RKeyX", "RKeyY", "RKeyScale", "ShowTouchRTrigger", &g_Config.touchRKey, defaultTouchPosShow, true, true),
ConfigSetting("AnalogStickX", "AnalogStickY", "AnalogStickScale", "ShowAnalogStick", &g_Config.touchAnalogStick, defaultTouchPosShow, true, true),
ConfigSetting("RightAnalogStickX", "RightAnalogStickY", "RightAnalogStickScale", "ShowRightAnalogStick", &g_Config.touchRightAnalogStick, defaultTouchPosHide, true, true),

ConfigSetting("fcombo0X", "fcombo0Y", "comboKeyScale0", "ShowComboKey0", &g_Config.touchCombo0, defaultTouchPosHide, true, true),
ConfigSetting("fcombo1X", "fcombo1Y", "comboKeyScale1", "ShowComboKey1", &g_Config.touchCombo1, defaultTouchPosHide, true, true),
Expand Down Expand Up @@ -1575,6 +1576,7 @@ void Config::ResetControlLayout() {
reset(g_Config.touchLKey);
reset(g_Config.touchRKey);
reset(g_Config.touchAnalogStick);
reset(g_Config.touchRightAnalogStick);
reset(g_Config.touchCombo0);
reset(g_Config.touchCombo1);
reset(g_Config.touchCombo2);
Expand Down
1 change: 1 addition & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ struct Config {
ConfigTouchPos touchLKey;
ConfigTouchPos touchRKey;
ConfigTouchPos touchAnalogStick;
ConfigTouchPos touchRightAnalogStick;

ConfigTouchPos touchCombo0;
ConfigTouchPos touchCombo1;
Expand Down
12 changes: 12 additions & 0 deletions UI/GamepadEmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ void InitPadLayout(float xres, float yres, float globalScale) {
float Action_button_spacing = g_Config.fActionButtonSpacing * baseActionButtonSpacing;
int Action_button_center_X = xres - Action_button_spacing * 2;
int Action_button_center_Y = yres - Action_button_spacing * 2;
if (g_Config.touchRightAnalogStick.show) {
Action_button_center_Y -= 150 * scale;
}
initTouchPos(g_Config.touchActionButtonCenter, Action_button_center_X, Action_button_center_Y);

//D-PAD (up down left right) (aka PSP cross)----------------------------
Expand All @@ -480,6 +483,12 @@ void InitPadLayout(float xres, float yres, float globalScale) {
int analog_stick_Y = yres - 80 * scale;
initTouchPos(g_Config.touchAnalogStick, analog_stick_X, analog_stick_Y);

//right analog stick-------------------------------------------------
//keep the right analog stick right below the face buttons
int right_analog_stick_X = Action_button_center_X;
int right_analog_stick_Y = yres - 80 * scale;
initTouchPos(g_Config.touchRightAnalogStick, right_analog_stick_X, right_analog_stick_Y);

//select, start, throttle--------------------------------------------
//space between the bottom keys (space between select, start and un-throttle)
float bottom_key_spacing = 100;
Expand Down Expand Up @@ -642,6 +651,9 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause) {
if (g_Config.touchAnalogStick.show)
root->Add(new PSPStick(stickBg, stickImage, I_STICK, 0, g_Config.touchAnalogStick.scale, buttonLayoutParams(g_Config.touchAnalogStick)));

if (g_Config.touchRightAnalogStick.show)
root->Add(new PSPStick(stickBg, stickImage, I_STICK, 1, g_Config.touchRightAnalogStick.scale, buttonLayoutParams(g_Config.touchRightAnalogStick)));

addComboKey(g_Config.iCombokey0, roundImage, I_ROUND, comboKeyImages[0], g_Config.touchCombo0);
addComboKey(g_Config.iCombokey1, roundImage, I_ROUND, comboKeyImages[1], g_Config.touchCombo1);
addComboKey(g_Config.iCombokey2, roundImage, I_ROUND, comboKeyImages[2], g_Config.touchCombo2);
Expand Down
3 changes: 3 additions & 0 deletions UI/TouchControlLayoutScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ void TouchControlLayoutScreen::CreateViews() {
if (g_Config.touchAnalogStick.show) {
controls_.push_back(new DragDropButton(g_Config.touchAnalogStick, stickBg, stickImage));
}
if (g_Config.touchRightAnalogStick.show) {
controls_.push_back(new DragDropButton(g_Config.touchRightAnalogStick, stickBg, stickImage));
}
if (g_Config.touchCombo0.show) {
controls_.push_back(new DragDropButton(g_Config.touchCombo0, roundImage, comboKeyImages[0]));
}
Expand Down
1 change: 1 addition & 0 deletions UI/TouchControlVisibilityScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ void TouchControlVisibilityScreen::CreateViews() {
toggles_.push_back({ "Select", &g_Config.touchSelectKey.show, I_SELECT });
toggles_.push_back({ "Dpad", &g_Config.touchDpad.show, -1 });
toggles_.push_back({ "Analog Stick", &g_Config.touchAnalogStick.show, -1 });
toggles_.push_back({ "Right Analog Stick\n(not used by most games)", &g_Config.touchRightAnalogStick.show, -1 });
toggles_.push_back({ "Unthrottle", &g_Config.touchUnthrottleKey.show, -1 });
toggles_.push_back({ "Combo0", &g_Config.touchCombo0.show, I_1 });
toggles_.push_back({ "Combo1", &g_Config.touchCombo1.show, I_2 });
Expand Down