diff --git a/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.cpp b/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.cpp index cfc9fac..fff1a0a 100644 --- a/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.cpp +++ b/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.cpp @@ -4,6 +4,8 @@ using namespace olc; +QuickGUI::TextBox*prevTextBox=nullptr; + // Override base class with your custom functionality class ChampionsLeaguePointSolver : public olc::PixelGameEngine { @@ -219,21 +221,26 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine } } public: - QuickGUI::TextBox*prevTextBox=nullptr; struct SongElement{ SongElement(QuickGUI::Manager&manager,std::string songName,vf2d pos){ label=new QuickGUI::Label(manager,songName,pos,{164,12}); p1Score=new QuickGUI::TextBox(manager,"",pos+vf2d{192,0},{36,12}); p2Score=new QuickGUI::TextBox(manager,"",pos+vf2d{192+42*1,0},{36,12}); p3Score=new QuickGUI::TextBox(manager,"",pos+vf2d{192+42*2,0},{36,12}); + if(prevTextBox!=nullptr){ + prevTextBox->tabNext=p1Score; + } + p1Score->tabNext=p2Score; + p1Score->tabPrev=prevTextBox; + p2Score->tabNext=p3Score; + p2Score->tabPrev=p1Score; + prevTextBox=p3Score; + p3Score->tabPrev=p2Score; } QuickGUI::Label*label; QuickGUI::TextBox*p1Score; QuickGUI::TextBox*p2Score; QuickGUI::TextBox*p3Score; - QuickGUI::TextBox*prevP1Box; - QuickGUI::TextBox*prevP2Box; - QuickGUI::TextBox*prevP3Box; }; QuickGUI::Manager gui; std::vectorsongs; diff --git a/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.wasm b/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.wasm index 4e12aaa..87e1494 100755 Binary files a/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.wasm and b/ChallengeLeaguePointSolver/ChampionsLeaguePointSolver.wasm differ diff --git a/ChallengeLeaguePointSolver/olcPGEX_QuickGUI.h b/ChallengeLeaguePointSolver/olcPGEX_QuickGUI.h index e1801da..8721dd6 100644 --- a/ChallengeLeaguePointSolver/olcPGEX_QuickGUI.h +++ b/ChallengeLeaguePointSolver/olcPGEX_QuickGUI.h @@ -601,8 +601,26 @@ namespace olc::QuickGUI } } - if (m_bTextEdit && pge->IsTextEntryEnabled()) + if (m_bTextEdit && pge->IsTextEntryEnabled()){ sText = pge->TextEntryGetString(); + if((pge->GetKey(olc::Key::TAB).bPressed||pge->GetKey(olc::Key::ENTER).bPressed)&&!TextBox::bBoxClicked){ + if(pge->GetKey(olc::Key::SHIFT).bHeld){ + if(tabPrev!=nullptr){ + m_bTextEdit = false; + pge->TextEntryEnable(true, tabPrev->sText); + tabPrev->m_bTextEdit=true; + TextBox::bBoxClicked=true; + } + }else{ + if(tabNext!=nullptr){ + m_bTextEdit = false; + pge->TextEntryEnable(true, tabNext->sText); + tabNext->m_bTextEdit=true; + TextBox::bBoxClicked=true; + } + } + } + } } void TextBox::Draw(olc::PixelGameEngine* pge) diff --git a/ChallengeLeaguePointSolver/pixelGameEngine.h b/ChallengeLeaguePointSolver/pixelGameEngine.h index b454963..0190a7d 100644 --- a/ChallengeLeaguePointSolver/pixelGameEngine.h +++ b/ChallengeLeaguePointSolver/pixelGameEngine.h @@ -3664,7 +3664,7 @@ namespace olc else { OnTextEntryComplete(sTextEntryString); - TextEntryEnable(false); + //TextEntryEnable(false); } } } diff --git a/ChallengeLeaguePointSolver/pixelGameEngine_wasm.o b/ChallengeLeaguePointSolver/pixelGameEngine_wasm.o index 99249c3..268c82a 100644 Binary files a/ChallengeLeaguePointSolver/pixelGameEngine_wasm.o and b/ChallengeLeaguePointSolver/pixelGameEngine_wasm.o differ