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