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

Method createTinkerMenu

src/interface/interface.cpp:15823–16263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15821const int kTinkerCraftSlotHeightOffset = 6; // slightly taller than normal slots
15822
15823void GenericGUIMenu::TinkerGUI_t::createTinkerMenu()
15824{
15825 const int player = parentGUI.getPlayer();
15826 if ( !gui || !tinkerFrame || !players[player]->inventoryUI.frame )
15827 {
15828 return;
15829 }
15830 if ( tinkerGUIHasBeenCreated() )
15831 {
15832 return;
15833 }
15834
15835 SDL_Rect basePos{ 0, 0, tinkerBaseWidth, 312 };
15836 {
15837 auto drawerFrame = tinkerFrame->addFrame("tinker drawer");
15838 SDL_Rect drawerPos{ 0, 0, 210, 256 };
15839 drawerFrame->setSize(drawerPos);
15840 drawerFrame->setHollow(false);
15841 auto bg = drawerFrame->addImage(drawerPos,
15842 makeColor(255, 255, 255, 255),
15843 "*images/ui/Tinkering/Tinker_Construct_Drawer_01.png", "tinker drawer img");
15844 drawerFrame->setDisabled(true);
15845
15846 auto headerFont = "fonts/pixel_maz_multiline.ttf#16#2";
15847 auto blueprintsTitle = drawerFrame->addField("blueprints title", 128);
15848 blueprintsTitle->setFont(headerFont);
15849 blueprintsTitle->setText(Language::get(4199));
15850 blueprintsTitle->setHJustify(Field::justify_t::CENTER);
15851 blueprintsTitle->setVJustify(Field::justify_t::TOP);
15852 blueprintsTitle->setSize(SDL_Rect{ 60, 1, 90, 24 });
15853 blueprintsTitle->setTextColor(hudColors.characterSheetLightNeutral);
15854 blueprintsTitle->setOutlineColor(makeColor(29, 16, 11, 255));
15855
15856 const int inventorySlotSize = players[player]->inventoryUI.getSlotSize();
15857
15858 tinkerSlotFrames.clear();
15859
15860 const int baseSlotOffsetX = 0;
15861 const int baseSlotOffsetY = 0;
15862
15863 SDL_Rect tinkerSlotsPos{ 0, 0, 210, 256 };
15864 {
15865 const auto drawerSlotsFrame = drawerFrame->addFrame("drawer slots");
15866 drawerSlotsFrame->setSize(tinkerSlotsPos);
15867 drawerSlotsFrame->setHollow(true);
15868
15869 /*auto gridImg = drawerSlotsFrame->addImage(SDL_Rect{ 0, 0, tinkerSlotsPos.w, tinkerSlotsPos.h },
15870 makeColor(255, 255, 255, 255), "*images/ui/Tinkering/Tinker_Construct_DrawerSlots_01.png", "grid img");
15871 gridImg->disabled = true;*/
15872
15873 SDL_Rect currentSlotPos{ baseSlotOffsetX, baseSlotOffsetY, inventorySlotSize, inventorySlotSize };
15874 const int maxTinkerX = MAX_TINKER_X;
15875 const int maxTinkerY = MAX_TINKER_Y;
15876
15877 const int slotInnerWidth = inventorySlotSize - 2;
15878 std::vector<std::pair<int, int>> slotCoords =
15879 {
15880 std::make_pair(4 + (slotInnerWidth + 2) * 0, 26),

Callers

nothing calls this directly

Calls 15

makeColorFunction · 0.85
onTinkerChangeTabActionFunction · 0.85
addFrameMethod · 0.80
setHollowMethod · 0.80
addImageMethod · 0.80
addFieldMethod · 0.80
setOutlineColorMethod · 0.80
findFrameMethod · 0.80
getSizeMethod · 0.80
addButtonMethod · 0.80
setHideGlyphsMethod · 0.80

Tested by

no test coverage detected