MCPcopy Create free account
hub / github.com/TurningWheel/Barony / createAlchemyMenu

Method createAlchemyMenu

src/interface/interface.cpp:19132–19670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19130const int kRecipeGridImgHeight = 240;
19131
19132void GenericGUIMenu::AlchemyGUI_t::createAlchemyMenu()
19133{
19134 const int player = parentGUI.getPlayer();
19135 if ( !gui || !alchFrame || !players[player]->inventoryUI.frame )
19136 {
19137 return;
19138 }
19139 if ( alchemyGUIHasBeenCreated() )
19140 {
19141 return;
19142 }
19143
19144 SDL_Rect basePos{ 0, 0, alchemyBaseWidth, 350 };
19145 alchemySlotFrames.clear();
19146 const int recipeWidth = 196;
19147 Frame* frame = alchFrame->addFrame("player recipes");
19148 recipesFrame = frame;
19149 frame->setSize(SDL_Rect{ 0,
19150 16,
19151 recipeWidth,
19152 kRecipeListHeight });
19153 frame->setHollow(false);
19154 frame->setBorder(0);
19155 frame->setOwner(player);
19156 frame->setInheritParentFrameOpacity(false);
19157 frame->setDisabled(true);
19158 const int inventorySlotSize = players[player]->inventoryUI.getSlotSize();
19159
19160 {
19161 int numGrids = (MAX_ALCH_Y / recipes.kNumRecipesToDisplayVertical) + 1;
19162 const int baseSlotOffsetX = 0;
19163 const int baseSlotOffsetY = 0;
19164 const int baseGridOffsetY = kRecipeListGridY;
19165
19166 SDL_Rect recipeSlotsPos{ 6, 0, recipeWidth, kRecipeListHeight };
19167 auto recipeSlotsFrame = recipesFrame->addFrame("alchemy slots");
19168 recipeSlotsFrame->setSize(recipeSlotsPos);
19169 recipeSlotsFrame->setActualSize(SDL_Rect{ 0, 0, recipeSlotsPos.w, (kRecipeGridImgHeight + 2) * numGrids });
19170 recipeSlotsFrame->setHollow(true);
19171 recipeSlotsFrame->setAllowScrollBinds(false);
19172 recipeSlotsFrame->setScrollBarsEnabled(false);
19173
19174 auto gridImg = recipeSlotsFrame->addImage(SDL_Rect{ baseSlotOffsetX, baseGridOffsetY, 162, (kRecipeGridImgHeight + 2) * numGrids },
19175 0xFFFFFFFF, "*images/ui/Alchemy/Alchemy_ScrollGrid.png", "grid img");
19176 gridImg->tiled = true;
19177
19178 SDL_Rect currentSlotPos{ baseSlotOffsetX, baseSlotOffsetY, inventorySlotSize, inventorySlotSize };
19179 const int maxRecipesX = MAX_ALCH_X;
19180 const int maxRecipesY = MAX_ALCH_Y;
19181
19182 auto cursorFrame = recipeSlotsFrame->addFrame("active recipe");
19183 cursorFrame->setSize(SDL_Rect{ 0, 0, inventorySlotSize, inventorySlotSize });
19184 cursorFrame->setDisabled(true);
19185 auto color = makeColor(177, 72, 3, 255);
19186 cursorFrame->addImage(SDL_Rect{ 0, 0, 14, 14 },
19187 color, "*#images/ui/Inventory/SelectorGrey_TL.png", "cursor topleft");
19188 cursorFrame->addImage(SDL_Rect{ 0, 0, 14, 14 },
19189 color, "*#images/ui/Inventory/SelectorGrey_TR.png", "cursor topright");

Callers

nothing calls this directly

Calls 15

makeColorFunction · 0.85
addFrameMethod · 0.80
setHollowMethod · 0.80
setOwnerMethod · 0.80
setActualSizeMethod · 0.80
setAllowScrollBindsMethod · 0.80
setScrollBarsEnabledMethod · 0.80
addImageMethod · 0.80
addFieldMethod · 0.80
addButtonMethod · 0.80
setHideGlyphsMethod · 0.80

Tested by

no test coverage detected