Setup initial interface design and layout
This commit is contained in:
parent
f7d046f7b6
commit
0bf8df4c74
@ -1,37 +1,95 @@
|
|||||||
#define OLC_PGE_APPLICATION
|
#define OLC_PGE_APPLICATION
|
||||||
#include "olcPixelGameEngine.h"
|
#include "olcPixelGameEngine.h"
|
||||||
|
#define OLC_PGEX_QUICKGUI
|
||||||
|
#include "olcPGEX_QuickGUI.h"
|
||||||
|
|
||||||
using namespace olc;
|
using namespace olc;
|
||||||
|
using namespace olc::QuickGUI;
|
||||||
|
|
||||||
|
#define PROGRAM_WIDTH 1600
|
||||||
|
|
||||||
|
int PANEL_WIDTH=620;
|
||||||
|
int PANEL_HEIGHT=240;
|
||||||
|
|
||||||
class FiestaCraftingCalculator : public olc::PixelGameEngine
|
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:
|
public:
|
||||||
FiestaCraftingCalculator()
|
FiestaCraftingCalculator()
|
||||||
{
|
{
|
||||||
sAppName = "Example";
|
sAppName = "Fiesta Crafting Calculator";
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool OnUserCreate() override
|
bool OnUserCreate() override
|
||||||
{
|
{
|
||||||
// Called once at the start, so create things here
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnUserUpdate(float fElapsedTime) override
|
bool OnUserUpdate(float fElapsedTime) override
|
||||||
{
|
{
|
||||||
for (int x = 0; x < ScreenWidth(); x++)
|
if(GetKey(SPACE).bPressed){
|
||||||
for (int y = 0; y < ScreenHeight(); y++)
|
calculators.push_back(new Calculator(vf2d{float(10+calculators.size()%2*PANEL_WIDTH),float(10+calculators.size()/2*PANEL_HEIGHT)}));
|
||||||
Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));
|
}
|
||||||
|
DrawDecal({float(ScreenWidth()-Karen.Sprite()->width),float(ScreenHeight()-Karen.Sprite()->height)},Karen.Decal());
|
||||||
|
for(Calculator*c:calculators){
|
||||||
|
c->Update(this);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Renderable FiestaCraftingCalculator::ProdIcon;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
FiestaCraftingCalculator calculator;
|
FiestaCraftingCalculator calculator;
|
||||||
if (calculator.Construct(256, 240, 4, 4))
|
if (calculator.Construct(PROGRAM_WIDTH, 960, 1, 1))
|
||||||
calculator.Start();
|
calculator.Start();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -104,6 +104,7 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -130,6 +131,7 @@
|
|||||||
<ClCompile Include="FiestaCraftingCalculator.cpp" />
|
<ClCompile Include="FiestaCraftingCalculator.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="olcPGEX_QuickGUI.h" />
|
||||||
<ClInclude Include="olcPixelGameEngine.h" />
|
<ClInclude Include="olcPixelGameEngine.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
@ -23,5 +23,8 @@
|
|||||||
<ClInclude Include="olcPixelGameEngine.h">
|
<ClInclude Include="olcPixelGameEngine.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="olcPGEX_QuickGUI.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
BIN
FiestaCraftingCalculator/assets/AdlF_Karen.png
Normal file
BIN
FiestaCraftingCalculator/assets/AdlF_Karen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 252 KiB |
BIN
FiestaCraftingCalculator/assets/production_icons.png
Normal file
BIN
FiestaCraftingCalculator/assets/production_icons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
1214
FiestaCraftingCalculator/olcPGEX_QuickGUI.h
Normal file
1214
FiestaCraftingCalculator/olcPGEX_QuickGUI.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user