Setup initial interface design and layout

master
sigonasr2 1 year ago
parent f7d046f7b6
commit 0bf8df4c74
  1. 68
      FiestaCraftingCalculator/FiestaCraftingCalculator.cpp
  2. 2
      FiestaCraftingCalculator/FiestaCraftingCalculator.vcxproj
  3. 3
      FiestaCraftingCalculator/FiestaCraftingCalculator.vcxproj.filters
  4. BIN
      FiestaCraftingCalculator/assets/AdlF_Karen.png
  5. BIN
      FiestaCraftingCalculator/assets/production_icons.png
  6. 1214
      FiestaCraftingCalculator/olcPGEX_QuickGUI.h

@ -1,37 +1,95 @@
#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 = "Example";
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
{
for (int x = 0; x < ScreenWidth(); x++)
for (int y = 0; y < ScreenHeight(); y++)
Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));
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(256, 240, 4, 4))
if (calculator.Construct(PROGRAM_WIDTH, 960, 1, 1))
calculator.Start();
return 0;

@ -104,6 +104,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -130,6 +131,7 @@
<ClCompile Include="FiestaCraftingCalculator.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="olcPGEX_QuickGUI.h" />
<ClInclude Include="olcPixelGameEngine.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

@ -23,5 +23,8 @@
<ClInclude Include="olcPixelGameEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="olcPGEX_QuickGUI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save