mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Customizable touch control (rebased with label)
This commit is contained in:
1 parent
4423e44b24
commit
498878267a
25 files changed
+873
-426
No files matched your search
@@ -333,6 +333,7 @@ void ControlLayoutView::Touch(const TouchInput &touch) {
|
||||
}
|
||||
|
||||
void ControlLayoutView::CreateViews() {
|
||||
using namespace CustomKey;
|
||||
const Bounds &bounds = GetBounds();
|
||||
if (bounds.w == 0.0f || bounds.h == 0.0f) {
|
||||
// Layout hasn't happened yet, return.
|
||||
@@ -356,8 +357,6 @@ void ControlLayoutView::CreateViews() {
|
||||
ImageID stickBg = g_Config.iTouchButtonStyle ? ImageID("I_STICK_BG_LINE") : ImageID("I_STICK_BG");
|
||||
ImageID roundImage = g_Config.iTouchButtonStyle ? ImageID("I_ROUND_LINE") : ImageID("I_ROUND");
|
||||
|
||||
const ImageID comboKeyImages[5] = { ImageID("I_1"), ImageID("I_2"), ImageID("I_3"), ImageID("I_4"), ImageID("I_5") };
|
||||
|
||||
auto addDragDropButton = [&](ConfigTouchPos &pos, const char *key, ImageID bgImg, ImageID img) {
|
||||
DragDropButton *b = nullptr;
|
||||
if (pos.show) {
|
||||
@@ -377,22 +376,6 @@ void ControlLayoutView::CreateViews() {
|
||||
if (auto *unthrottle = addDragDropButton(g_Config.touchUnthrottleKey, "Unthrottle button", rectImage, ImageID("I_ARROW"))) {
|
||||
unthrottle->SetAngle(180.0f);
|
||||
}
|
||||
if (auto *speed1 = addDragDropButton(g_Config.touchSpeed1Key, "Alternate speed 1 button", rectImage, ImageID("I_ARROW"))) {
|
||||
speed1->SetAngle(170.0f, 180.0f);
|
||||
}
|
||||
if (auto *speed2 = addDragDropButton(g_Config.touchSpeed2Key, "Alternate speed 2 button", rectImage, ImageID("I_ARROW"))) {
|
||||
speed2->SetAngle(190.0f, 180.0f);
|
||||
}
|
||||
if (auto *rapidFire = addDragDropButton(g_Config.touchRapidFireKey, "Rapid fire button", rectImage, ImageID("I_ARROW"))) {
|
||||
rapidFire->SetAngle(90.0f, 180.0f);
|
||||
}
|
||||
if (auto *analogRotationCW = addDragDropButton(g_Config.touchAnalogRotationCWKey, "Analog clockwise rotation button", rectImage, ImageID("I_ARROW"))) {
|
||||
analogRotationCW->SetAngle(190.0f, 180.0f);
|
||||
}
|
||||
if (auto *analogRotationCCW = addDragDropButton(g_Config.touchAnalogRotationCCWKey, "Analog counter clockwise rotation button", rectImage, ImageID("I_ARROW"))) {
|
||||
analogRotationCCW->SetAngle(350.0f, 180.0f);
|
||||
}
|
||||
|
||||
addDragDropButton(g_Config.touchLKey, "Left shoulder button", shoulderImage, ImageID("I_L"));
|
||||
if (auto *rbutton = addDragDropButton(g_Config.touchRKey, "Right shoulder button", shoulderImage, ImageID("I_R"))) {
|
||||
rbutton->FlipImageH(true);
|
||||
@@ -400,11 +383,27 @@ void ControlLayoutView::CreateViews() {
|
||||
|
||||
addDragDropButton(g_Config.touchAnalogStick, "Left analog stick", stickBg, stickImage);
|
||||
addDragDropButton(g_Config.touchRightAnalogStick, "Right analog stick", stickBg, stickImage);
|
||||
addDragDropButton(g_Config.touchCombo0, "Combo 1 button", roundImage, comboKeyImages[0]);
|
||||
addDragDropButton(g_Config.touchCombo1, "Combo 2 button", roundImage, comboKeyImages[1]);
|
||||
addDragDropButton(g_Config.touchCombo2, "Combo 3 button", roundImage, comboKeyImages[2]);
|
||||
addDragDropButton(g_Config.touchCombo3, "Combo 4 button", roundImage, comboKeyImages[3]);
|
||||
addDragDropButton(g_Config.touchCombo4, "Combo 5 button", roundImage, comboKeyImages[4]);
|
||||
|
||||
auto addDragComboKey = [&](ConfigTouchPos &pos, const char *key, const ConfigCustomButton& cfg) {
|
||||
DragDropButton *b = nullptr;
|
||||
if (pos.show) {
|
||||
b = new DragDropButton(pos, key, g_Config.iTouchButtonStyle == 0 ? comboKeyShapes[cfg.shape].i : comboKeyShapes[cfg.shape].l, comboKeyImages[cfg.image].i, bounds);
|
||||
b->FlipImageH(comboKeyShapes[cfg.shape].f);
|
||||
b->SetAngle(comboKeyImages[cfg.image].r, comboKeyShapes[cfg.shape].r);
|
||||
controls_.push_back(b);
|
||||
}
|
||||
return b;
|
||||
};
|
||||
addDragComboKey(g_Config.touchCombo0, "Custom 1 button", g_Config.CustomKey0);
|
||||
addDragComboKey(g_Config.touchCombo1, "Custom 2 button", g_Config.CustomKey1);
|
||||
addDragComboKey(g_Config.touchCombo2, "Custom 3 button", g_Config.CustomKey2);
|
||||
addDragComboKey(g_Config.touchCombo3, "Custom 4 button", g_Config.CustomKey3);
|
||||
addDragComboKey(g_Config.touchCombo4, "Custom 5 button", g_Config.CustomKey4);
|
||||
addDragComboKey(g_Config.touchCombo5, "Custom 6 button", g_Config.CustomKey5);
|
||||
addDragComboKey(g_Config.touchCombo6, "Custom 7 button", g_Config.CustomKey6);
|
||||
addDragComboKey(g_Config.touchCombo7, "Custom 8 button", g_Config.CustomKey7);
|
||||
addDragComboKey(g_Config.touchCombo8, "Custom 9 button", g_Config.CustomKey8);
|
||||
addDragComboKey(g_Config.touchCombo9, "Custom 10 button", g_Config.CustomKey9);
|
||||
|
||||
for (size_t i = 0; i < controls_.size(); i++) {
|
||||
Add(controls_[i]);
|
||||
@@ -500,7 +499,7 @@ void TouchControlLayoutScreen::CreateViews() {
|
||||
|
||||
Choice *reset = new Choice(di->T("Reset"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 84));
|
||||
Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 10));
|
||||
Choice *visibility = new Choice(co->T("Visibility"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 298));
|
||||
Choice *visibility = new Choice(co->T("Customize"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 298));
|
||||
// controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fButtonScale, 0.80, 2.0, co->T("Button Scaling"), screenManager()))
|
||||
// ->OnChange.Handle(this, &GameSettingsScreen::OnChangeControlScaling);
|
||||
|
||||
|
||||
Reference in new issue
Block a user