diff --git a/data/images/layoutSwitchButton.png b/data/images/layoutSwitchButton.png new file mode 100644 index 0000000..838a8c6 Binary files /dev/null and b/data/images/layoutSwitchButton.png differ diff --git a/data/images/settingsButton.png b/data/images/settingsButton.png new file mode 100644 index 0000000..e5a7c69 Binary files /dev/null and b/data/images/settingsButton.png differ diff --git a/data/sounds/settings_click_2.mp3 b/data/sounds/settings_click_2.mp3 new file mode 100644 index 0000000..92f1e74 Binary files /dev/null and b/data/sounds/settings_click_2.mp3 differ diff --git a/src/menu/MainDrcButtonsFrame.h b/src/menu/MainDrcButtonsFrame.h index 684af2b..5cf5b17 100644 --- a/src/menu/MainDrcButtonsFrame.h +++ b/src/menu/MainDrcButtonsFrame.h @@ -61,12 +61,6 @@ public: switchLayoutButton.setEffectGrow(); switchLayoutButton.clicked.connect(this, &MainDrcButtonsFrame::OnLayoutSwithClick); append(&switchLayoutButton); - - gameImageDownloadButton.setClickable(true); - gameImageDownloadButton.setSoundClick(buttonClickSound); - gameImageDownloadButton.setTrigger(&plusTrigger); - gameImageDownloadButton.clicked.connect(this, &MainDrcButtonsFrame::OnGameImageDownloadButtonClicked); - append(&gameImageDownloadButton); } virtual ~MainDrcButtonsFrame() { @@ -78,7 +72,6 @@ public: sigslot::signal1 settingsButtonClicked; sigslot::signal1 layoutSwitchClicked; - sigslot::signal1 gameImageDownloadClicked; private: void OnSettingsButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *) { settingsButtonClicked(this); @@ -86,9 +79,6 @@ private: void OnLayoutSwithClick(GuiButton *button, const GuiController *controller, GuiTrigger *) { layoutSwitchClicked(this); } - void OnGameImageDownloadButtonClicked(GuiButton *button, const GuiController *controller, GuiTrigger *) { - gameImageDownloadClicked(this); - } GuiSound *buttonClickSound; GuiSound *screenSwitchSound; diff --git a/src/menu/MainWindow.cpp b/src/menu/MainWindow.cpp index 22cf3d3..1815a69 100644 --- a/src/menu/MainWindow.cpp +++ b/src/menu/MainWindow.cpp @@ -181,7 +181,10 @@ void MainWindow::SetupMainView() { currentTvFrame->effectFinished.connect(this, &MainWindow::OnOpenEffectFinish); appendTv(currentTvFrame); - currentDrcFrame = currentTvFrame; + currentDrcFrame = new GuiIconGrid(width, height,0); + currentDrcFrame->setEffect(EFFECT_FADE, 10, 255); + currentDrcFrame->setState(GuiElement::STATE_DISABLED); + currentDrcFrame->effectFinished.connect(this, &MainWindow::OnOpenEffectFinish); if(currentTvFrame != currentDrcFrame) { @@ -206,6 +209,8 @@ void MainWindow::SetupMainView() { currentDrcFrame->gameLaunchClicked.connect(this, &MainWindow::OnGameLaunch); mainSwitchButtonFrame = new MainDrcButtonsFrame(width, height); + mainSwitchButtonFrame->settingsButtonClicked.connect(this, &MainWindow::OnSettingsButtonClicked); + mainSwitchButtonFrame->layoutSwitchClicked.connect(this, &MainWindow::OnLayoutSwitchClicked); mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED); mainSwitchButtonFrame->setEffect(EFFECT_FADE, 10, 255); mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED); @@ -215,6 +220,62 @@ void MainWindow::SetupMainView() { append(mainSwitchButtonFrame); } +void MainWindow::OnLayoutSwitchClicked(GuiElement *element) { + if(!currentTvFrame || !currentDrcFrame || !mainSwitchButtonFrame) { + return; + } + + if(currentTvFrame == currentDrcFrame) { + return; + } + + currentTvFrame->setState(GuiElement::STATE_DISABLED); + currentTvFrame->setEffect(EFFECT_FADE, -15, 0); + currentTvFrame->effectFinished.connect(this, &MainWindow::OnLayoutSwitchEffectFinish); + + currentDrcFrame->setState(GuiElement::STATE_DISABLED); + currentDrcFrame->setEffect(EFFECT_FADE, -15, 0); + + mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED); +} + +void MainWindow::OnLayoutSwitchEffectFinish(GuiElement *element) { + if(!currentTvFrame || !currentDrcFrame || !mainSwitchButtonFrame) + return; + + element->effectFinished.disconnect(this); + remove(currentDrcFrame); + remove(currentTvFrame); + + GuiTitleBrowser *tmpElement = currentDrcFrame; + currentDrcFrame = currentTvFrame; + currentTvFrame = tmpElement; + + appendTv(currentTvFrame); + appendDrc(currentDrcFrame); + //! re-append on top + append(mainSwitchButtonFrame); + + currentTvFrame->resetState(); + currentTvFrame->setEffect(EFFECT_FADE, 15, 255); + + currentDrcFrame->resetState(); + currentDrcFrame->setEffect(EFFECT_FADE, 15, 255); + + mainSwitchButtonFrame->clearState(GuiElement::STATE_DISABLED); + + //! reconnect only to DRC game selection change + currentTvFrame->gameSelectionChanged.disconnect(this); + currentDrcFrame->gameSelectionChanged.disconnect(this); + currentTvFrame->gameLaunchClicked.disconnect(this); + currentDrcFrame->gameLaunchClicked.disconnect(this); + + currentTvFrame->gameSelectionChanged.connect(this, &MainWindow::OnGameSelectionChange); + currentTvFrame->gameLaunchClicked.connect(this, &MainWindow::OnGameLaunch); + currentDrcFrame->gameSelectionChanged.connect(this, &MainWindow::OnGameSelectionChange); + currentDrcFrame->gameLaunchClicked.connect(this, &MainWindow::OnGameLaunch); +} + void MainWindow::OnOpenEffectFinish(GuiElement *element) { //! once the menu is open reset its state and allow it to be "clicked/hold" element->effectFinished.disconnect(this); @@ -227,6 +288,10 @@ void MainWindow::OnCloseEffectFinish(GuiElement *element) { AsyncExecutor::pushForDelete(element); } +void MainWindow::OnSettingsButtonClicked(GuiElement *element){ + +} + void MainWindow::OnGameSelectionChange(GuiTitleBrowser *element, int32_t selectedIdx) { if(!currentDrcFrame || !currentTvFrame) return; diff --git a/src/menu/MainWindow.h b/src/menu/MainWindow.h index f0a6f25..5bb2f9a 100644 --- a/src/menu/MainWindow.h +++ b/src/menu/MainWindow.h @@ -119,6 +119,10 @@ private: void OnGameLaunch(GuiTitleBrowser *element, int32_t gameIdx); void OnGameSelectionChange(GuiTitleBrowser *element, int32_t selectedIdx); + void OnSettingsButtonClicked(GuiElement *element); + void OnLayoutSwitchClicked(GuiElement *element); + void OnLayoutSwitchEffectFinish(GuiElement *element); + int32_t width, height; std::vector drcElements; std::vector tvElements;