From d099692ed0c0cd0c4d2b25f886a23732a8370790 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 19 Oct 2013 23:14:51 -0400 Subject: [PATCH] Make Toggle All actually function. --- Core/Config.cpp | 21 ++++++++++----------- UI/GameSettingsScreen.cpp | 1 - UI/GamepadEmu.cpp | 8 ++++++-- UI/TouchControlLayoutScreen.cpp | 2 +- UI/TouchControlVisibilityScreen.cpp | 8 +++----- UI/TouchControlVisibilityScreen.h | 8 +++----- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index b2d3551f7b..e6e8e7ecc0 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -192,16 +192,16 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) IniFile::Section *control = iniFile.GetOrCreateSection("Control"); control->Get("HapticFeedback", &bHapticFeedback, true); control->Get("ShowAnalogStick", &bShowTouchAnalogStick, true); - control->Get("ShowTouchCross", bShowTouchCross); - control->Get("ShowTouchCircle", bShowTouchCircle); - control->Get("ShowTouchSquare", bShowTouchSquare); - control->Get("ShowTouchTriangle", bShowTouchTriangle); - control->Get("ShowTouchStart", bShowTouchStart); - control->Get("ShowTouchSelect", bShowTouchSelect); - control->Get("ShowTouchLTrigger", bShowTouchLTrigger); - control->Get("ShowTouchRTrigger", bShowTouchRTrigger); - control->Get("ShowAnalogStick", bShowTouchAnalogStick); - control->Get("ShowTouchUnthrottle", bShowTouchUnthrottle); + control->Get("ShowTouchCross", &bShowTouchCross); + control->Get("ShowTouchCircle", &bShowTouchCircle); + control->Get("ShowTouchSquare", &bShowTouchSquare); + control->Get("ShowTouchTriangle", &bShowTouchTriangle); + control->Get("ShowTouchStart", &bShowTouchStart); + control->Get("ShowTouchSelect", &bShowTouchSelect); + control->Get("ShowTouchLTrigger", &bShowTouchLTrigger); + control->Get("ShowTouchRTrigger", &bShowTouchRTrigger); + control->Get("ShowAnalogStick", &bShowTouchAnalogStick); + control->Get("ShowTouchUnthrottle", &bShowTouchUnthrottle); #if defined(USING_GLES2) std::string name = System_GetProperty(SYSPROP_NAME); @@ -391,7 +391,6 @@ void Config::Save() { IniFile::Section *control = iniFile.GetOrCreateSection("Control"); control->Set("HapticFeedback", bHapticFeedback); - control->Set("ShowTouchControls", bShowTouchControls); control->Set("ShowTouchCross", bShowTouchCross); control->Set("ShowTouchCircle", bShowTouchCircle); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index d6ff14d83e..defea84d5b 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -217,7 +217,6 @@ void GameSettingsScreen::CreateViews() { controlsSettings->Add(new Choice("Control Visibility..."))->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlVisibility); controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 0, 100, c->T("Button Opacity"), screenManager())); controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fButtonScale, 0.80, 2.0, c->T("Button Scaling"), screenManager())); - controlsSettings->Add(new Choice("Control Visibility..."))->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlVisibility); // System ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index 65a42ec8c9..ad64efd5d6 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -286,7 +286,7 @@ void InitPadLayout() { int Action_button_center_X = dp_xres - Action_button_spacing * 2; int Action_button_center_Y = dp_yres - Action_button_spacing * 2; - if(g_Config.iActionButtonCenterX == -1 || g_Config.iActionButtonCenterY == -1 ){ + if(g_Config.iActionButtonCenterX == -1 || g_Config.iActionButtonCenterY == -1 ) { //setup defaults g_Config.iActionButtonCenterX = Action_button_center_X; g_Config.iActionButtonCenterY = Action_button_center_Y; @@ -297,7 +297,7 @@ void InitPadLayout() { //radius to the D-pad const int D_pad_Radius = 40 * scale; - if (g_Config.iDpadRadius == -1){ + if (g_Config.iDpadRadius == -1) { g_Config.iDpadRadius = D_pad_Radius; } @@ -433,12 +433,16 @@ UI::ViewGroup *CreatePadLayout(bool *pause) { float scale = g_Config.fButtonScale; <<<<<<< HEAD +<<<<<<< HEAD #if USE_PAUSE_BUTTON root->Add(new BoolButton(pause, I_ROUND, I_ARROW, scale, new AnchorLayoutParams(halfW, 20, NONE, NONE, true)))->SetAngle(90); #endif ======= +======= + +>>>>>>> 4936897... Make Toggle All actually function. if (g_Config.bShowTouchCircle) >>>>>>> 86338a5... Add a touch control visibility screen. All touch controls can now be toggled on or off, except for the Pause button on platforms that have it, as a safety precaution. root->Add(new PSPButton(CTRL_CIRCLE, I_ROUND, I_CIRCLE, scale, new AnchorLayoutParams(Action_circle_button_X, Action_circle_button_Y, NONE, NONE, true))); diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index aab85a125a..e9d6ca9474 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -272,7 +272,7 @@ void TouchControlLayoutScreen::CreateViews() { rbutton->FlipImageH(true); controls_.push_back(rbutton); - if (g_Config.bShowAnalogStick) { + if (g_Config.bShowTouchAnalogStick) { controls_.push_back(new DragDropButton(g_Config.iAnalogStickX, g_Config.iAnalogStickY, I_STICKBG, I_STICK, scale)); }; I18NCategory *ms = GetI18NCategory("MainSettings"); diff --git a/UI/TouchControlVisibilityScreen.cpp b/UI/TouchControlVisibilityScreen.cpp index e8fe19cfb8..8077d3c472 100644 --- a/UI/TouchControlVisibilityScreen.cpp +++ b/UI/TouchControlVisibilityScreen.cpp @@ -23,10 +23,6 @@ #include #include -TouchControlVisibilityScreen::TouchControlVisibilityScreen() { - -} - void TouchControlVisibilityScreen::CreateViews() { using namespace UI; @@ -58,7 +54,6 @@ void TouchControlVisibilityScreen::CreateViews() { keyImages["L"] = I_L; keyImages["R"] = I_R; - std::map keyToggles; keyToggles["Circle"] = &g_Config.bShowTouchCircle; keyToggles["Cross"] = &g_Config.bShowTouchCross; keyToggles["Square"] = &g_Config.bShowTouchSquare; @@ -98,5 +93,8 @@ UI::EventReturn TouchControlVisibilityScreen::OnBack(UI::EventParams &e) { } UI::EventReturn TouchControlVisibilityScreen::OnToggleAll(UI::EventParams &e) { + for (auto i = keyToggles.begin(); i != keyToggles.end(); ++i) + *i->second = !*i->second; + return UI::EVENT_DONE; } diff --git a/UI/TouchControlVisibilityScreen.h b/UI/TouchControlVisibilityScreen.h index 50abef490b..5b9d880e35 100644 --- a/UI/TouchControlVisibilityScreen.h +++ b/UI/TouchControlVisibilityScreen.h @@ -24,7 +24,7 @@ class TouchControlVisibilityScreen : public UIScreenWithBackground { public: - TouchControlVisibilityScreen(); + TouchControlVisibilityScreen::TouchControlVisibilityScreen() { } virtual void CreateViews(); @@ -33,7 +33,5 @@ protected: virtual UI::EventReturn OnToggleAll(UI::EventParams &e); private: - //DragDropButton *pickedControl_; - //std::vector controls_; - //DragDropButton *getPickedControl(const int x, const int y); -}; \ No newline at end of file + std::map keyToggles; +};