Display Items required and items produced.

master
sigonasr2 1 year ago
parent 63a4949c3d
commit 28493a2102
  1. 33
      FiestaCraftingCalculator/FiestaCraftingCalculator.cpp

@ -165,7 +165,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine
RecipeList->m_pSlider->fValue=0; RecipeList->m_pSlider->fValue=0;
RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0; RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0;
for(Recipe&r:PotionProdRecipes){ for(Recipe&r:PotionProdRecipes){
recipeItems.push_back(r.DisplayName); recipeItems.push_back(IDToName[r.Product].name);
} }
selectedItem=&PotionProdRecipes[0]; selectedItem=&PotionProdRecipes[0];
} }
@ -180,7 +180,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine
RecipeList->m_pSlider->fValue=0; RecipeList->m_pSlider->fValue=0;
RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0; RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0;
for(Recipe&r:StoneProdRecipes){ for(Recipe&r:StoneProdRecipes){
recipeItems.push_back(r.DisplayName); recipeItems.push_back(IDToName[r.Product].name);
} }
selectedItem=&StoneProdRecipes[0]; selectedItem=&StoneProdRecipes[0];
} }
@ -195,7 +195,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine
RecipeList->m_pSlider->fValue=0; RecipeList->m_pSlider->fValue=0;
RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0; RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0;
for(Recipe&r:ScrollProdRecipes){ for(Recipe&r:ScrollProdRecipes){
recipeItems.push_back(r.DisplayName); recipeItems.push_back(IDToName[r.Product].name);
} }
selectedItem=&ScrollProdRecipes[0]; selectedItem=&ScrollProdRecipes[0];
} }
@ -210,7 +210,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine
RecipeList->m_pSlider->fValue=0; RecipeList->m_pSlider->fValue=0;
RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0; RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0;
for(Recipe&r:CompRecipes){ for(Recipe&r:CompRecipes){
recipeItems.push_back(r.DisplayName); recipeItems.push_back(IDToName[r.Product].name);
} }
selectedItem=&CompRecipes[0]; selectedItem=&CompRecipes[0];
} }
@ -225,7 +225,7 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine
RecipeList->m_pSlider->fValue=0; RecipeList->m_pSlider->fValue=0;
RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0; RecipeList->nSelectedItem=RecipeList->nPreviouslySelectedItem=0;
for(Recipe&r:DecompRecipes){ for(Recipe&r:DecompRecipes){
recipeItems.push_back(r.DisplayName); recipeItems.push_back(IDToName[r.Product].name);
} }
selectedItem=&DecompRecipes[0]; selectedItem=&DecompRecipes[0];
} }
@ -255,6 +255,29 @@ class FiestaCraftingCalculator : public olc::PixelGameEngine
if(RecipeList->bVisible){ if(RecipeList->bVisible){
ItemData data = IDToName[selectedItem->Product]; ItemData data = IDToName[selectedItem->Product];
data.DrawIcon(pge,displayPos+vf2d{320,40}); data.DrawIcon(pge,displayPos+vf2d{320,40});
float stringWidth=pge->GetTextSizeProp(data.name).x*2;
if(stringWidth>PANEL_WIDTH-356){
float scale=(PANEL_WIDTH-356)/stringWidth;
pge->DrawStringPropDecal(displayPos+vf2d{356,40},data.name,WHITE,{2*scale,2});
} else {
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->DrawStringDecal(displayPos+vf2d{320,80},"Requires:");
float yOffset=0;
for(std::pair<std::string,int>&item:selectedItem->requiredItems){
data = IDToName[item.first];
data.DrawIcon(pge,displayPos+vf2d{320,92+yOffset});
float stringWidth=pge->GetTextSizeProp(data.name).x*2;
if(stringWidth>PANEL_WIDTH-356){
float scale=(PANEL_WIDTH-356)/stringWidth;
pge->DrawStringPropDecal(displayPos+vf2d{356,92+yOffset},data.name,WHITE,{2*scale,2});
} else {
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});
yOffset+=36;
}
} }
manager.DrawDecal(pge); manager.DrawDecal(pge);
return true; return true;

Loading…
Cancel
Save