UI: Add text description for all views.

This commit is contained in:
Unknown W. Brackets
2021-02-21 16:38:02 -08:00
parent 7c72fe7110
commit 3c778f567c
23 changed files with 252 additions and 103 deletions
+31 -27
View File
@@ -38,8 +38,8 @@ static u32 GetButtonColor() {
class DragDropButton : public MultiTouchButton {
public:
DragDropButton(ConfigTouchPos &pos, ImageID bgImg, ImageID img, const Bounds &screenBounds)
: MultiTouchButton(bgImg, bgImg, img, pos.scale, new UI::AnchorLayoutParams(pos.x * screenBounds.w, pos.y * screenBounds.h, UI::NONE, UI::NONE, true)),
DragDropButton(ConfigTouchPos &pos, const char *key, ImageID bgImg, ImageID img, const Bounds &screenBounds)
: MultiTouchButton(key, bgImg, bgImg, img, pos.scale, new UI::AnchorLayoutParams(pos.x * screenBounds.w, pos.y * screenBounds.h, UI::NONE, UI::NONE, true)),
x_(pos.x), y_(pos.y), theScale_(pos.scale), screenBounds_(screenBounds) {
scale_ = theScale_;
}
@@ -76,8 +76,8 @@ private:
class PSPActionButtons : public DragDropButton {
public:
PSPActionButtons(ConfigTouchPos &pos, float &spacing, const Bounds &screenBounds)
: DragDropButton(pos, ImageID::invalid(), ImageID::invalid(), screenBounds), spacing_(spacing) {
PSPActionButtons(ConfigTouchPos &pos, const char *key, float &spacing, const Bounds &screenBounds)
: DragDropButton(pos, key, ImageID::invalid(), ImageID::invalid(), screenBounds), spacing_(spacing) {
using namespace UI;
roundId_ = g_Config.iTouchButtonStyle ? ImageID("I_ROUND_LINE") : ImageID("I_ROUND");
};
@@ -155,8 +155,8 @@ private:
class PSPDPadButtons : public DragDropButton {
public:
PSPDPadButtons(ConfigTouchPos &pos, float &spacing, const Bounds &screenBounds)
: DragDropButton(pos, ImageID::invalid(), ImageID::invalid(), screenBounds), spacing_(spacing) {
PSPDPadButtons(ConfigTouchPos &pos, const char *key, float &spacing, const Bounds &screenBounds)
: DragDropButton(pos, key, ImageID::invalid(), ImageID::invalid(), screenBounds), spacing_(spacing) {
}
void Draw(UIContext &dc) override {
@@ -221,6 +221,10 @@ public:
}
}
std::string DescribeText() const override {
return "";
}
private:
int x1, x2, y1, y2;
u32 col;
@@ -338,7 +342,7 @@ void ControlLayoutView::CreateViews() {
// Create all the views.
PSPActionButtons *actionButtons = new PSPActionButtons(g_Config.touchActionButtonCenter, g_Config.fActionButtonSpacing, bounds);
PSPActionButtons *actionButtons = new PSPActionButtons(g_Config.touchActionButtonCenter, "Action buttons", g_Config.fActionButtonSpacing, bounds);
actionButtons->setCircleVisibility(g_Config.bShowTouchCircle);
actionButtons->setCrossVisibility(g_Config.bShowTouchCross);
actionButtons->setTriangleVisibility(g_Config.bShowTouchTriangle);
@@ -354,53 +358,53 @@ void ControlLayoutView::CreateViews() {
const ImageID comboKeyImages[5] = { ImageID("I_1"), ImageID("I_2"), ImageID("I_3"), ImageID("I_4"), ImageID("I_5") };
auto addDragDropButton = [&](ConfigTouchPos &pos, ImageID bgImg, ImageID img) {
auto addDragDropButton = [&](ConfigTouchPos &pos, const char *key, ImageID bgImg, ImageID img) {
DragDropButton *b = nullptr;
if (pos.show) {
b = new DragDropButton(pos, bgImg, img, bounds);
b = new DragDropButton(pos, key, bgImg, img, bounds);
controls_.push_back(b);
}
return b;
};
if (g_Config.touchDpad.show) {
controls_.push_back(new PSPDPadButtons(g_Config.touchDpad, g_Config.fDpadSpacing, bounds));
controls_.push_back(new PSPDPadButtons(g_Config.touchDpad, "D-pad", g_Config.fDpadSpacing, bounds));
}
addDragDropButton(g_Config.touchSelectKey, rectImage, ImageID("I_SELECT"));
addDragDropButton(g_Config.touchStartKey, rectImage, ImageID("I_START"));
addDragDropButton(g_Config.touchSelectKey, "Select button", rectImage, ImageID("I_SELECT"));
addDragDropButton(g_Config.touchStartKey, "Start button", rectImage, ImageID("I_START"));
if (auto *unthrottle = addDragDropButton(g_Config.touchUnthrottleKey, rectImage, ImageID("I_ARROW"))) {
if (auto *unthrottle = addDragDropButton(g_Config.touchUnthrottleKey, "Unthrottle button", rectImage, ImageID("I_ARROW"))) {
unthrottle->SetAngle(180.0f);
}
if (auto *speed1 = addDragDropButton(g_Config.touchSpeed1Key, rectImage, ImageID("I_ARROW"))) {
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, rectImage, ImageID("I_ARROW"))) {
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, rectImage, ImageID("I_ARROW"))) {
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, rectImage, ImageID("I_ARROW"))) {
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, rectImage, ImageID("I_ARROW"))) {
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, shoulderImage, ImageID("I_L"));
if (auto *rbutton = addDragDropButton(g_Config.touchRKey, shoulderImage, ImageID("I_R"))) {
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);
}
addDragDropButton(g_Config.touchAnalogStick, stickBg, stickImage);
addDragDropButton(g_Config.touchRightAnalogStick, stickBg, stickImage);
addDragDropButton(g_Config.touchCombo0, roundImage, comboKeyImages[0]);
addDragDropButton(g_Config.touchCombo1, roundImage, comboKeyImages[1]);
addDragDropButton(g_Config.touchCombo2, roundImage, comboKeyImages[2]);
addDragDropButton(g_Config.touchCombo3, roundImage, comboKeyImages[3]);
addDragDropButton(g_Config.touchCombo4, roundImage, comboKeyImages[4]);
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]);
for (size_t i = 0; i < controls_.size(); i++) {
Add(controls_[i]);