Compare commits
2 Commits
5ffbda7f46
...
0bf8df4c74
Author | SHA1 | Date |
---|---|---|
sigonasr2 | 0bf8df4c74 | 1 year ago |
sigonasr2 | f7d046f7b6 | 1 year ago |
@ -0,0 +1,96 @@ |
||||
#define OLC_PGE_APPLICATION |
||||
#include "olcPixelGameEngine.h" |
||||
#define OLC_PGEX_QUICKGUI |
||||
#include "olcPGEX_QuickGUI.h" |
||||
|
||||
using namespace olc; |
||||
using namespace olc::QuickGUI; |
||||
|
||||
#define PROGRAM_WIDTH 1600 |
||||
|
||||
int PANEL_WIDTH=620; |
||||
int PANEL_HEIGHT=240; |
||||
|
||||
class FiestaCraftingCalculator : public olc::PixelGameEngine |
||||
{ |
||||
static Renderable ProdIcon; |
||||
class Calculator{ |
||||
Manager manager; |
||||
vf2d displayPos={10,10}; |
||||
ImageCheckBox*PotionProd; |
||||
ImageCheckBox*StoneProd; |
||||
ImageCheckBox*ScrollProd; |
||||
ImageCheckBox*CompProd; |
||||
ImageCheckBox*DecompProd; |
||||
public: |
||||
Calculator(vf2d displayPos) |
||||
:displayPos(displayPos){ |
||||
PotionProd=new ImageCheckBox(manager,FiestaCraftingCalculator::ProdIcon,false,displayPos+vi2d{10,10},{40,40},{192,128},{32,32}); |
||||
StoneProd=new ImageCheckBox(manager,FiestaCraftingCalculator::ProdIcon,false,displayPos+vi2d{55,10},{40,40},{0,160},{32,32}); |
||||
ScrollProd=new ImageCheckBox(manager,FiestaCraftingCalculator::ProdIcon,false,displayPos+vi2d{100,10},{40,40},{224,128},{32,32}); |
||||
CompProd=new ImageCheckBox(manager,FiestaCraftingCalculator::ProdIcon,false,displayPos+vi2d{145,10},{40,40},{96,160},{32,32}); |
||||
DecompProd=new ImageCheckBox(manager,FiestaCraftingCalculator::ProdIcon,false,displayPos+vi2d{190,10},{40,40},{64,160},{32,32}); |
||||
} |
||||
void Update(FiestaCraftingCalculator*pge){ |
||||
manager.Update(pge); |
||||
if(PotionProd->bPressed){ |
||||
StoneProd->bChecked=ScrollProd->bChecked=CompProd->bChecked=DecompProd->bChecked=false; |
||||
} |
||||
if(StoneProd->bPressed){ |
||||
PotionProd->bChecked=ScrollProd->bChecked=CompProd->bChecked=DecompProd->bChecked=false; |
||||
} |
||||
if(ScrollProd->bPressed){ |
||||
StoneProd->bChecked=PotionProd->bChecked=CompProd->bChecked=DecompProd->bChecked=false; |
||||
} |
||||
if(CompProd->bPressed){ |
||||
StoneProd->bChecked=ScrollProd->bChecked=PotionProd->bChecked=DecompProd->bChecked=false; |
||||
} |
||||
if(DecompProd->bPressed){ |
||||
StoneProd->bChecked=ScrollProd->bChecked=CompProd->bChecked=PotionProd->bChecked=false; |
||||
} |
||||
pge->GradientFillRectDecal(displayPos-vf2d{2,2},{float(PANEL_WIDTH),float(PANEL_HEIGHT)},{49, 32, 61,216},{0,0,0,216},{0,0,0,216},{49, 32, 61,216}); |
||||
pge->DrawRectDecal(displayPos-vf2d{1,1},{float(PANEL_WIDTH),float(PANEL_HEIGHT)},{131, 90, 161}); |
||||
manager.DrawDecal(pge); |
||||
} |
||||
}; |
||||
std::vector<Calculator*>calculators; |
||||
Renderable Karen; |
||||
public: |
||||
FiestaCraftingCalculator() |
||||
{ |
||||
sAppName = "Fiesta Crafting Calculator"; |
||||
} |
||||
|
||||
public: |
||||
bool OnUserCreate() override |
||||
{ |
||||
// Called once at the start, so create things here
|
||||
ProdIcon.Load("assets/production_icons.png"); |
||||
Karen.Load("assets/AdlF_Karen.png"); |
||||
calculators.push_back(new Calculator({10,10})); |
||||
return true; |
||||
} |
||||
|
||||
bool OnUserUpdate(float fElapsedTime) override |
||||
{ |
||||
if(GetKey(SPACE).bPressed){ |
||||
calculators.push_back(new Calculator(vf2d{float(10+calculators.size()%2*PANEL_WIDTH),float(10+calculators.size()/2*PANEL_HEIGHT)})); |
||||
} |
||||
DrawDecal({float(ScreenWidth()-Karen.Sprite()->width),float(ScreenHeight()-Karen.Sprite()->height)},Karen.Decal()); |
||||
for(Calculator*c:calculators){ |
||||
c->Update(this); |
||||
} |
||||
return true; |
||||
} |
||||
}; |
||||
|
||||
Renderable FiestaCraftingCalculator::ProdIcon; |
||||
|
||||
int main() |
||||
{ |
||||
FiestaCraftingCalculator calculator; |
||||
if (calculator.Construct(PROGRAM_WIDTH, 960, 1, 1)) |
||||
calculator.Start(); |
||||
|
||||
return 0; |
||||
} |
After Width: | Height: | Size: 252 KiB |
After Width: | Height: | Size: 113 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue