|
|
@ -172,6 +172,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
} |
|
|
|
} |
|
|
|
selectedItem=&PotionProdRecipes[0]; |
|
|
|
selectedItem=&PotionProdRecipes[0]; |
|
|
|
|
|
|
|
Amount->sText="1"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(PotionProd->bHovered){ |
|
|
|
if(PotionProd->bHovered){ |
|
|
|
DisplayProdText="Potion Production"; |
|
|
|
DisplayProdText="Potion Production"; |
|
|
@ -187,6 +188,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
} |
|
|
|
} |
|
|
|
selectedItem=&StoneProdRecipes[0]; |
|
|
|
selectedItem=&StoneProdRecipes[0]; |
|
|
|
|
|
|
|
Amount->sText="1"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(StoneProd->bHovered){ |
|
|
|
if(StoneProd->bHovered){ |
|
|
|
DisplayProdText="Stone Production"; |
|
|
|
DisplayProdText="Stone Production"; |
|
|
@ -202,6 +204,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
} |
|
|
|
} |
|
|
|
selectedItem=&ScrollProdRecipes[0]; |
|
|
|
selectedItem=&ScrollProdRecipes[0]; |
|
|
|
|
|
|
|
Amount->sText="1"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(ScrollProd->bHovered){ |
|
|
|
if(ScrollProd->bHovered){ |
|
|
|
DisplayProdText="Scroll Production"; |
|
|
|
DisplayProdText="Scroll Production"; |
|
|
@ -217,6 +220,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
} |
|
|
|
} |
|
|
|
selectedItem=&CompRecipes[0]; |
|
|
|
selectedItem=&CompRecipes[0]; |
|
|
|
|
|
|
|
Amount->sText="1"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(CompProd->bHovered){ |
|
|
|
if(CompProd->bHovered){ |
|
|
|
DisplayProdText="Material Composition"; |
|
|
|
DisplayProdText="Material Composition"; |
|
|
@ -232,6 +236,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
recipeItems.push_back(IDToName[r.Product].name); |
|
|
|
} |
|
|
|
} |
|
|
|
selectedItem=&DecompRecipes[0]; |
|
|
|
selectedItem=&DecompRecipes[0]; |
|
|
|
|
|
|
|
Amount->sText="1"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(DecompProd->bHovered){ |
|
|
|
if(DecompProd->bHovered){ |
|
|
|
DisplayProdText="Material Decomposition"; |
|
|
|
DisplayProdText="Material Decomposition"; |
|
|
@ -258,6 +263,10 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{10,10+54},DisplayProdText,WHITE,{2,2}); |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{10,10+54},DisplayProdText,WHITE,{2,2}); |
|
|
|
if(RecipeList->bVisible){ |
|
|
|
if(RecipeList->bVisible){ |
|
|
|
ItemData data = IDToName[selectedItem->Product]; |
|
|
|
ItemData data = IDToName[selectedItem->Product]; |
|
|
|
|
|
|
|
int quantityRequested=1; |
|
|
|
|
|
|
|
if(Amount->sText.size()>0&&Amount->sText[0]>='0'&&Amount->sText[0]<='9'){ |
|
|
|
|
|
|
|
quantityRequested=stoi(Amount->sText); |
|
|
|
|
|
|
|
} |
|
|
|
data.DrawIcon(pge,displayPos+vf2d{320,40}); |
|
|
|
data.DrawIcon(pge,displayPos+vf2d{320,40}); |
|
|
|
float stringWidth=pge->GetTextSizeProp(data.name).x*2; |
|
|
|
float stringWidth=pge->GetTextSizeProp(data.name).x*2; |
|
|
|
if(stringWidth>PANEL_WIDTH-356){ |
|
|
|
if(stringWidth>PANEL_WIDTH-356){ |
|
|
@ -266,7 +275,8 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{356,40},data.name,WHITE,{2,2});
|
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{356,40},data.name,WHITE,{2,2});
|
|
|
|
} |
|
|
|
} |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{360,58},"x "+std::to_string(selectedItem->amt),WHITE,{1.75,1.75}); |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{264,16},"Crafts: ",WHITE,{1.75,1.75}); |
|
|
|
|
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{360,58},"x "+std::to_string(selectedItem->amt*quantityRequested),WHITE,{1.75,1.75}); |
|
|
|
pge->DrawStringDecal(displayPos+vf2d{320,80},"Requires:"); |
|
|
|
pge->DrawStringDecal(displayPos+vf2d{320,80},"Requires:"); |
|
|
|
float yOffset=0; |
|
|
|
float yOffset=0; |
|
|
|
for(std::pair<std::string,int>&item:selectedItem->requiredItems){ |
|
|
|
for(std::pair<std::string,int>&item:selectedItem->requiredItems){ |
|
|
@ -279,7 +289,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{356,92+yOffset},data.name,WHITE,{2,2});
|
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{356,92+yOffset},data.name,WHITE,{2,2});
|
|
|
|
} |
|
|
|
} |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{360,110+yOffset},"x "+std::to_string(item.second),WHITE,{1.75,1.75}); |
|
|
|
pge->DrawStringPropDecal(displayPos+vf2d{360,110+yOffset},"x "+std::to_string(item.second*quantityRequested),WHITE,{1.75,1.75}); |
|
|
|
yOffset+=36; |
|
|
|
yOffset+=36; |
|
|
|
} |
|
|
|
} |
|
|
|
if(Amount->m_bTextEdit){ |
|
|
|
if(Amount->m_bTextEdit){ |
|
|
@ -313,7 +323,9 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static std::vector<Calculator*>calculators; |
|
|
|
static std::vector<Calculator*>calculators; |
|
|
|
static Renderable ProdIcon,CloseIcon,CloseBackIcon,ProductionIcons,CollectibleIcons,CollectibleIcons2,GradeIcons; |
|
|
|
Manager manager; |
|
|
|
|
|
|
|
Button*AddButton; |
|
|
|
|
|
|
|
static Renderable ProdIcon,CloseIcon,CloseBackIcon,ProductionIcons,CollectibleIcons,CollectibleIcons2,GradeIcons,PlusIcon,PlusBackIcon; |
|
|
|
public: |
|
|
|
public: |
|
|
|
std::string slurp(std::ifstream& in) { |
|
|
|
std::string slurp(std::ifstream& in) { |
|
|
|
std::ostringstream sstr; |
|
|
|
std::ostringstream sstr; |
|
|
@ -399,17 +411,36 @@ public: |
|
|
|
CollectibleIcons.Load("assets/collectibles.png",nullptr,true); |
|
|
|
CollectibleIcons.Load("assets/collectibles.png",nullptr,true); |
|
|
|
CollectibleIcons2.Load("assets/collectibles2.png",nullptr,true); |
|
|
|
CollectibleIcons2.Load("assets/collectibles2.png",nullptr,true); |
|
|
|
GradeIcons.Load("assets/grade.png",nullptr,true); |
|
|
|
GradeIcons.Load("assets/grade.png",nullptr,true); |
|
|
|
|
|
|
|
PlusIcon.Load("assets/plus_button.png",nullptr,true); |
|
|
|
|
|
|
|
PlusBackIcon.Load("assets/button_plus_mask.png",nullptr,true); |
|
|
|
calculators.push_back(new Calculator()); |
|
|
|
calculators.push_back(new Calculator()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AddButton=new Button(manager,"Add Panel",{PROGRAM_WIDTH-256,float(ScreenHeight()-Karen.Sprite()->height-240)},{172,36},{2,2}); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawCenteredStringDecal(const vf2d&pos,const std::string&text,Pixel col,const vf2d&scale){ |
|
|
|
|
|
|
|
DrawStringDecal(pos-GetTextSize(text)*scale/2,text,col,scale); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool OnUserUpdate(float fElapsedTime) override |
|
|
|
bool OnUserUpdate(float fElapsedTime) override |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(GetKey(SPACE).bPressed){ |
|
|
|
/*if(GetKey(SPACE).bPressed){
|
|
|
|
calculators.push_back(new Calculator()); |
|
|
|
calculators.push_back(new Calculator()); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawCenteredStringDecal({float(ScreenWidth()-175),64},"Fiesta Online",WHITE,{2,3}); |
|
|
|
|
|
|
|
DrawCenteredStringDecal({float(ScreenWidth()-175),64+24},"Crafting Calculator",WHITE,{2,3}); |
|
|
|
|
|
|
|
DrawCenteredStringDecal({float(ScreenWidth()-175),64+24*4},"Made using the",WHITE,{2,3}); |
|
|
|
|
|
|
|
DrawCenteredStringDecal({float(ScreenWidth()-175),64+24*5},"olcPixelGameEngine",WHITE,{2,3}); |
|
|
|
|
|
|
|
|
|
|
|
DrawDecal({float(ScreenWidth()-Karen.Sprite()->width),float(ScreenHeight()-Karen.Sprite()->height)},Karen.Decal()); |
|
|
|
DrawDecal({float(ScreenWidth()-Karen.Sprite()->width),float(ScreenHeight()-Karen.Sprite()->height)},Karen.Decal()); |
|
|
|
int panelNumber=0; |
|
|
|
int panelNumber=0; |
|
|
|
|
|
|
|
manager.Update(this); |
|
|
|
|
|
|
|
if(AddButton->bPressed){ |
|
|
|
|
|
|
|
calculators.push_back(new Calculator()); |
|
|
|
|
|
|
|
} |
|
|
|
for(auto it=calculators.begin();it!=calculators.end();++it){ |
|
|
|
for(auto it=calculators.begin();it!=calculators.end();++it){ |
|
|
|
Calculator*c=*it; |
|
|
|
Calculator*c=*it; |
|
|
|
if (!c->Update(this,panelNumber)){ |
|
|
|
if (!c->Update(this,panelNumber)){ |
|
|
@ -420,11 +451,12 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
++panelNumber; |
|
|
|
++panelNumber; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
manager.DrawDecal(this); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Renderable FiestaCraftingCalculator::ProdIcon,FiestaCraftingCalculator::CloseIcon,FiestaCraftingCalculator::CloseBackIcon,FiestaCraftingCalculator::ProductionIcons,FiestaCraftingCalculator::CollectibleIcons,FiestaCraftingCalculator::CollectibleIcons2,FiestaCraftingCalculator::GradeIcons; |
|
|
|
Renderable FiestaCraftingCalculator::ProdIcon,FiestaCraftingCalculator::CloseIcon,FiestaCraftingCalculator::CloseBackIcon,FiestaCraftingCalculator::ProductionIcons,FiestaCraftingCalculator::CollectibleIcons,FiestaCraftingCalculator::CollectibleIcons2,FiestaCraftingCalculator::GradeIcons,FiestaCraftingCalculator::PlusIcon,FiestaCraftingCalculator::PlusBackIcon; |
|
|
|
std::vector<FiestaCraftingCalculator::Recipe> FiestaCraftingCalculator::PotionProdRecipes; |
|
|
|
std::vector<FiestaCraftingCalculator::Recipe> FiestaCraftingCalculator::PotionProdRecipes; |
|
|
|
std::vector<FiestaCraftingCalculator::Recipe> FiestaCraftingCalculator::StoneProdRecipes; |
|
|
|
std::vector<FiestaCraftingCalculator::Recipe> FiestaCraftingCalculator::StoneProdRecipes; |
|
|
|
std::vector<FiestaCraftingCalculator::Recipe> FiestaCraftingCalculator::ScrollProdRecipes; |
|
|
|
std::vector<FiestaCraftingCalculator::Recipe> FiestaCraftingCalculator::ScrollProdRecipes; |
|
|
|