75#ifndef OLC_PGEX_QUICKGUI_H 
   76#define OLC_PGEX_QUICKGUI_H 
  168        bool m_bEraseControlsOnDestroy = 
true;
 
  170        std::vector<BaseControl*> m_vControls;
 
 
  179            const std::string& text,            
 
 
  208            const std::string& text,                
 
 
  227            const std::string& text,            
 
 
  250            const std::string& text,                
 
 
  334            std::vector<std::string>& vList,            
 
 
  379        bool m_bShowDialog = 
false;
 
  382        ListBox* m_listVolumes = 
nullptr;
 
  383        ListBox* m_listDirectory = 
nullptr;
 
  384        ListBox* m_listFiles = 
nullptr;
 
  386        std::vector<std::string> m_vVolumes;
 
  387        std::vector<std::string> m_vDirectory;
 
  388        std::vector<std::string> m_vFiles;
 
  389        std::filesystem::path m_path;
 
 
 
  394#ifdef OLC_PGEX_QUICKGUI 
  395#undef OLC_PGEX_QUICKGUI 
  399#pragma region BaseControl 
  402        m_manager.AddControl(
this);
 
  416#pragma region Manager 
  419        m_bEraseControlsOnDestroy = bCleanUpForMe;
 
  424        if (m_bEraseControlsOnDestroy)
 
  425            for (
auto& p : m_vControls)
 
  433        m_vControls.push_back(control);
 
  438        for (
auto& p : m_vControls) p->
Update(pge);
 
  443        for (
auto& p : m_vControls) p->
Draw(pge);
 
  448        for (
auto& p : m_vControls) p->
DrawDecal(pge);
 
  458        this->
colText = manager.colText;
 
  467        : BaseControl(manager)
 
  469        vPos = pos; vSize = size; sText = text;
 
  539#pragma region TextBox 
  541        : Label(manager, text, pos, size)
 
  543        nAlign = Alignment::Left;
 
  545        bHasBackground = 
false;
 
  661        : BaseControl(manager)
 
  663        vPos = pos; vSize = size; sText = text;
 
  760#pragma region ImageButton 
  762        : Button(manager, 
"", pos, size), pIcon(icon)
 
  781#pragma region ImageCheckBox 
  783        : ImageButton(manager, gfx, pos, size)
 
  828#pragma region CheckBox 
  830        : Button(manager, text, pos, size)
 
  877        : BaseControl(manager)
 
  879        vPosMin = posmin; vPosMax = posmax; fMin = valmin; fMax = valmax; fValue = value;
 
  988#pragma region ListBox 
  990        : BaseControl(manager), m_vList(vList)
 
  992        m_group.CopyThemeFrom(m_manager);
 
  995        m_pSlider = 
new Slider(m_group, { pos.
x + size.
x - m_manager.fGrabRad - 1, pos.
y + m_manager.fGrabRad + 1 },
 
  996            { pos.
x + size.
x - m_manager.fGrabRad - 1, pos.
y + size.
y - m_manager.fGrabRad - 1 }, 0, float(m_vList.size()), 0);     
 
 1040        size_t idx1 = std::min(idx0 + 
size_t((
vSize.
y - 4) / 10), 
m_vList.size());
 
 1043        for (
size_t idx = idx0; idx < idx1; idx++)
 
 1063        size_t idx1 = std::min(idx0 + 
size_t((
vSize.
y - 4) / 10), 
m_vList.size());
 
 1066        for (
size_t idx = idx0; idx < idx1; idx++)
 
 1094        m_listDirectory = 
new ListBox(m_manFileSelect, m_vDirectory, 
olc::vf2d(20, 20), 
olc::vf2d(300, 500));
 
 1095        m_listFiles = 
new ListBox(m_manFileSelect, m_vFiles, 
olc::vf2d(330, 20), 
olc::vf2d(300, 500));
 
 1098        for (
auto const& dir_entry : std::filesystem::directory_iterator{ m_path })
 
 1100            if(dir_entry.is_directory())
 
 1101                m_vDirectory.push_back(dir_entry.path().filename().string());
 
 1103                m_vFiles.push_back(dir_entry.path().filename().string());
 
 1109        m_bShowDialog = 
true;
 
 1114        if(!m_bShowDialog) 
return false;
 
 1116        m_manFileSelect.
Update(this->pge);
 
 1120            m_path = m_path.parent_path().string() + 
"/";
 
 1127            std::string sDirectory = m_vDirectory[m_listDirectory->
nSelectedItem];
 
 1134            m_path += sDirectory + 
"/";
 
 1136            m_vDirectory.clear();
 
 1141            for (
auto const& dir_entry : std::filesystem::directory_iterator{ m_path })
 
 1143                if (dir_entry.is_directory() || dir_entry.is_other())
 
 1144                    m_vDirectory.push_back(dir_entry.path().filename().string());
 
 1146                    m_vFiles.push_back(dir_entry.path().filename().string());
 
 1167            m_bShowDialog = 
false;
 
Definition olcPixelGameEngine.h:1685
 
static PixelGameEngine * pge
Definition olcPixelGameEngine.h:1697
 
Definition olcPixelGameEngine.h:1278
 
void FillRectDecal(const olc::vf2d &pos, const olc::vf2d &size, const olc::Pixel col=olc::WHITE)
 
void DrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, Pixel p=olc::WHITE, uint32_t pattern=0xFFFFFFFF)
 
void DrawStringProp(int32_t x, int32_t y, const std::string &sText, Pixel col=olc::WHITE, uint32_t scale=1)
 
void DrawRect(int32_t x, int32_t y, int32_t w, int32_t h, Pixel p=olc::WHITE)
 
HWButton GetKey(Key k) const
 
void SetDecalMode(const olc::DecalMode &mode)
 
void DrawCircle(int32_t x, int32_t y, int32_t radius, Pixel p=olc::WHITE, uint8_t mask=0xFF)
 
int32_t TextEntryGetCursor() const
 
void FillCircle(int32_t x, int32_t y, int32_t radius, Pixel p=olc::WHITE)
 
void TextEntryEnable(const bool bEnable, const std::string &sText="")
 
const olc::vi2d & GetScreenSize() const
 
void DrawDecal(const olc::vf2d &pos, olc::Decal *decal, const olc::vf2d &scale={ 1.0f, 1.0f }, const olc::Pixel &tint=olc::WHITE)
 
void DrawSprite(int32_t x, int32_t y, Sprite *sprite, uint32_t scale=1, uint8_t flip=olc::Sprite::NONE)
 
void DrawStringDecal(const olc::vf2d &pos, const std::string &sText, const Pixel col=olc::WHITE, const olc::vf2d &scale={ 1.0f, 1.0f })
 
void FillRect(int32_t x, int32_t y, int32_t w, int32_t h, Pixel p=olc::WHITE)
 
void DrawStringPropDecal(const olc::vf2d &pos, const std::string &sText, const Pixel col=olc::WHITE, const olc::vf2d &scale={ 1.0f, 1.0f })
 
const olc::vi2d & GetMousePos() const
 
void DrawLineDecal(const olc::vf2d &pos1, const olc::vf2d &pos2, Pixel p=olc::WHITE)
 
olc::vi2d GetTextSizeProp(const std::string &s)
 
std::string TextEntryGetString() const
 
bool IsTextEntryEnabled() const
 
HWButton GetMouse(uint32_t b) const
 
float GetElapsedTime() const
 
Definition olcPGEX_QuickGUI.h:87
 
float m_fTransition
Definition olcPGEX_QuickGUI.h:126
 
virtual void DrawDecal(olc::PixelGameEngine *pge)=0
 
olc::QuickGUI::Manager & m_manager
Definition olcPGEX_QuickGUI.h:116
 
State
Definition olcPGEX_QuickGUI.h:123
 
bool bHeld
Definition olcPGEX_QuickGUI.h:101
 
bool bVisible
Definition olcPGEX_QuickGUI.h:96
 
bool bReleased
Definition olcPGEX_QuickGUI.h:103
 
BaseControl(olc::QuickGUI::Manager &manager)
 
virtual void Draw(olc::PixelGameEngine *pge)=0
 
enum olc::QuickGUI::BaseControl::State m_state
 
virtual void Update(olc::PixelGameEngine *pge)=0
 
bool bPressed
Definition olcPGEX_QuickGUI.h:99
 
void Enable(const bool bEnable)
 
Definition olcPGEX_QuickGUI.h:247
 
void Update(olc::PixelGameEngine *pge) override
 
bool bChecked
Definition olcPGEX_QuickGUI.h:256
 
CheckBox(olc::QuickGUI::Manager &manager, const std::string &text, const bool check, const olc::vf2d &pos, const olc::vf2d &size)
 
void Draw(olc::PixelGameEngine *pge) override
 
void DrawDecal(olc::PixelGameEngine *pge) override
 
Definition olcPGEX_QuickGUI.h:281
 
void Draw(olc::PixelGameEngine *pge) override
 
void Update(olc::PixelGameEngine *pge) override
 
ImageCheckBox(olc::QuickGUI::Manager &manager, const olc::Renderable &icon, const bool check, const olc::vf2d &pos, const olc::vf2d &size)
 
void DrawDecal(olc::PixelGameEngine *pge) override
 
bool bChecked
Definition olcPGEX_QuickGUI.h:290
 
Definition olcPGEX_QuickGUI.h:176
 
olc::vf2d vSize
Definition olcPGEX_QuickGUI.h:187
 
enum olc::QuickGUI::Label::Alignment nAlign
 
olc::vf2d vPos
Definition olcPGEX_QuickGUI.h:185
 
std::string sText
Definition olcPGEX_QuickGUI.h:189
 
Alignment
Definition olcPGEX_QuickGUI.h:196
 
void Draw(olc::PixelGameEngine *pge) override
 
bool bHasBorder
Definition olcPGEX_QuickGUI.h:191
 
void DrawDecal(olc::PixelGameEngine *pge) override
 
Label(olc::QuickGUI::Manager &manager, const std::string &text, const olc::vf2d &pos, const olc::vf2d &size)
 
bool bHasBackground
Definition olcPGEX_QuickGUI.h:193
 
void Update(olc::PixelGameEngine *pge) override
 
Definition olcPGEX_QuickGUI.h:331
 
ListBox(olc::QuickGUI::Manager &manager, std::vector< std::string > &vList, const olc::vf2d &pos, const olc::vf2d &size)
 
Manager m_group
Definition olcPGEX_QuickGUI.h:349
 
void DrawDecal(olc::PixelGameEngine *pge) override
 
std::vector< std::string > & m_vList
Definition olcPGEX_QuickGUI.h:351
 
olc::vf2d vSize
Definition olcPGEX_QuickGUI.h:341
 
olc::vf2d vPos
Definition olcPGEX_QuickGUI.h:339
 
void Update(olc::PixelGameEngine *pge) override
 
bool bHasBorder
Definition olcPGEX_QuickGUI.h:343
 
size_t nPreviouslySelectedItem
Definition olcPGEX_QuickGUI.h:356
 
Slider * m_pSlider
Definition olcPGEX_QuickGUI.h:348
 
size_t nSelectedItem
Definition olcPGEX_QuickGUI.h:355
 
bool bSelectionChanged
Definition olcPGEX_QuickGUI.h:358
 
bool bHasBackground
Definition olcPGEX_QuickGUI.h:345
 
void Draw(olc::PixelGameEngine *pge) override
 
size_t m_nVisibleItems
Definition olcPGEX_QuickGUI.h:350
 
Definition olcPGEX_QuickGUI.h:132
 
float fHoverSpeedOn
Definition olcPGEX_QuickGUI.h:158
 
void CopyThemeFrom(const Manager &manager)
 
float fGrabRad
Definition olcPGEX_QuickGUI.h:162
 
olc::Pixel colBorder
Definition olcPGEX_QuickGUI.h:155
 
olc::Pixel colText
Definition olcPGEX_QuickGUI.h:156
 
void DrawDecal(olc::PixelGameEngine *pge)
 
olc::Pixel colClick
Definition olcPGEX_QuickGUI.h:153
 
Manager(const bool bCleanUpForMe=true)
 
void Update(olc::PixelGameEngine *pge)
 
void AddControl(BaseControl *control)
 
olc::Pixel colDisable
Definition olcPGEX_QuickGUI.h:154
 
void Draw(olc::PixelGameEngine *pge)
 
olc::Pixel colNormal
Definition olcPGEX_QuickGUI.h:151
 
float fHoverSpeedOff
Definition olcPGEX_QuickGUI.h:160
 
olc::Pixel colHover
Definition olcPGEX_QuickGUI.h:152
 
Definition olcPGEX_QuickGUI.h:368
 
void ShowFileOpen(const std::string &sPath)
 
virtual bool OnBeforeUserUpdate(float &fElapsedTime) override
 
Definition olcPGEX_QuickGUI.h:301
 
void Draw(olc::PixelGameEngine *pge) override
 
void Update(olc::PixelGameEngine *pge) override
 
olc::vf2d vPosMin
Definition olcPGEX_QuickGUI.h:319
 
float fMin
Definition olcPGEX_QuickGUI.h:312
 
float fValue
Definition olcPGEX_QuickGUI.h:316
 
void DrawDecal(olc::PixelGameEngine *pge) override
 
float fMax
Definition olcPGEX_QuickGUI.h:314
 
Slider(olc::QuickGUI::Manager &manager, const olc::vf2d &posmin, const olc::vf2d &posmax, const float valmin, const float valmax, const float value)
 
olc::vf2d vPosMax
Definition olcPGEX_QuickGUI.h:321
 
Definition olcPGEX_QuickGUI.h:205
 
void DrawDecal(olc::PixelGameEngine *pge) override
 
void Draw(olc::PixelGameEngine *pge) override
 
bool m_bTextEdit
Definition olcPGEX_QuickGUI.h:218
 
void Update(olc::PixelGameEngine *pge) override
 
TextBox(olc::QuickGUI::Manager &manager, const std::string &text, const olc::vf2d &pos, const olc::vf2d &size)
 
Definition olcPixelGameEngine.h:1149
 
olc::Sprite * Sprite() const
 
olc::Decal * Decal() const
 
Definition olcPGEX_QuickGUI.h:82
 
Definition olcPixelGameEngine.h:612
 
v_2d< float > vf2d
Definition olcPixelGameEngine.h:918
 
Pixel PixelLerp(const olc::Pixel &p1, const olc::Pixel &p2, float t)
 
static const Pixel CYAN(0, 255, 255)
 
static const Pixel DARK_GREY(128, 128, 128)
 
v_2d< int32_t > vi2d
Definition olcPixelGameEngine.h:916
 
static const Pixel BLUE(0, 0, 255)
 
static const Pixel DARK_BLUE(0, 0, 128)
 
static const Pixel WHITE(255, 255, 255)
 
Definition olcPixelGameEngine.h:948
 
T x
Definition olcPixelGameEngine.h:623
 
T y
Definition olcPixelGameEngine.h:625
 
constexpr auto dot(const v_2d &rhs) const
Definition olcPixelGameEngine.h:702
 
constexpr T mag2() const
Definition olcPixelGameEngine.h:659