Prep tab capabilities
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
c293288908
commit
04af30b30f
@ -219,6 +219,7 @@ 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});
|
||||
@ -230,6 +231,9 @@ class ChampionsLeaguePointSolver : public olc::PixelGameEngine
|
||||
QuickGUI::TextBox*p1Score;
|
||||
QuickGUI::TextBox*p2Score;
|
||||
QuickGUI::TextBox*p3Score;
|
||||
QuickGUI::TextBox*prevP1Box;
|
||||
QuickGUI::TextBox*prevP2Box;
|
||||
QuickGUI::TextBox*prevP3Box;
|
||||
};
|
||||
QuickGUI::Manager gui;
|
||||
std::vector<SongElement>songs;
|
||||
|
Binary file not shown.
@ -162,8 +162,6 @@ namespace olc::QuickGUI
|
||||
// Copy all theme attributes into a different manager object
|
||||
void CopyThemeFrom(const Manager& manager);
|
||||
|
||||
bool anotherBoxHighlighted=false;
|
||||
|
||||
private:
|
||||
// Should this manager call delete on the controls it opeerates?
|
||||
bool m_bEraseControlsOnDestroy = true;
|
||||
@ -214,10 +212,12 @@ namespace olc::QuickGUI
|
||||
void Update(olc::PixelGameEngine* pge) override;
|
||||
void Draw(olc::PixelGameEngine* pge) override;
|
||||
void DrawDecal(olc::PixelGameEngine* pge) override;
|
||||
static bool bBoxClicked; // Whether or not a Textbox instance was clicked this frame.
|
||||
TextBox*tabNext=nullptr;
|
||||
TextBox*tabPrev=nullptr;
|
||||
|
||||
protected:
|
||||
bool m_bTextEdit = false;
|
||||
|
||||
};
|
||||
|
||||
// Creates a Button Control - a clickable, labelled rectangle
|
||||
@ -436,7 +436,7 @@ namespace olc::QuickGUI
|
||||
|
||||
void Manager::Update(olc::PixelGameEngine* pge)
|
||||
{
|
||||
anotherBoxHighlighted=false;
|
||||
TextBox::bBoxClicked=false;
|
||||
for (auto& p : m_vControls) p->Update(pge);
|
||||
}
|
||||
|
||||
@ -539,6 +539,8 @@ namespace olc::QuickGUI
|
||||
|
||||
|
||||
#pragma region TextBox
|
||||
bool TextBox::bBoxClicked=false;
|
||||
|
||||
TextBox::TextBox(olc::QuickGUI::Manager& manager, const std::string& text, const olc::vf2d& pos, const olc::vf2d& size)
|
||||
: Label(manager, text, pos, size)
|
||||
{
|
||||
@ -573,7 +575,7 @@ namespace olc::QuickGUI
|
||||
|
||||
if (bPressed && !pge->IsTextEntryEnabled() && !m_bTextEdit)
|
||||
{
|
||||
m_manager.anotherBoxHighlighted=true;
|
||||
TextBox::bBoxClicked=true;
|
||||
pge->TextEntryEnable(true, sText);
|
||||
m_bTextEdit = true;
|
||||
}
|
||||
@ -591,7 +593,7 @@ namespace olc::QuickGUI
|
||||
|
||||
if (bPressed && m_bTextEdit)
|
||||
{
|
||||
if(!m_manager.anotherBoxHighlighted){
|
||||
if(!TextBox::bBoxClicked){
|
||||
sText = pge->TextEntryGetString();
|
||||
pge->TextEntryEnable(false);
|
||||
}
|
||||
@ -601,9 +603,6 @@ namespace olc::QuickGUI
|
||||
|
||||
if (m_bTextEdit && pge->IsTextEntryEnabled())
|
||||
sText = pge->TextEntryGetString();
|
||||
if(pge->GetKey(olc::Key::TAB).bPressed){
|
||||
m_manager.goNext=this;
|
||||
}
|
||||
}
|
||||
|
||||
void TextBox::Draw(olc::PixelGameEngine* pge)
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user