| 23211 | } |
| 23212 | |
| 23213 | void GenericGUIMenu::FeatherGUI_t::createFeatherMenu() |
| 23214 | { |
| 23215 | const int player = parentGUI.getPlayer(); |
| 23216 | if ( !gui || !featherFrame || !players[player]->inventoryUI.frame ) |
| 23217 | { |
| 23218 | return; |
| 23219 | } |
| 23220 | if ( featherGUIHasBeenCreated() ) |
| 23221 | { |
| 23222 | return; |
| 23223 | } |
| 23224 | |
| 23225 | SDL_Rect basePos{ 0, 0, featherBaseWidth, featherBaseHeight }; |
| 23226 | { |
| 23227 | auto drawerFrame = featherFrame->addFrame("feather drawer"); |
| 23228 | SDL_Rect drawerPos{ 0, 0, featherDrawerWidth, 260 }; |
| 23229 | drawerFrame->setSize(drawerPos); |
| 23230 | drawerPos.h -= 10; // empty area |
| 23231 | drawerFrame->setHollow(false); |
| 23232 | |
| 23233 | auto bg = drawerFrame->addImage(drawerPos, |
| 23234 | makeColor(255, 255, 255, 255), |
| 23235 | "*images/ui/Feather/Feather_Drawer_00.png", "feather drawer img"); |
| 23236 | drawerFrame->setDisabled(true); |
| 23237 | |
| 23238 | featherSlotFrames.clear(); |
| 23239 | |
| 23240 | const int baseSlotOffsetX = 0; |
| 23241 | const int baseSlotOffsetY = 0; |
| 23242 | |
| 23243 | SDL_Rect featherSlotsPos{ 6, 6, featherDrawerWidth, 240 }; |
| 23244 | { |
| 23245 | int numGrids = (MAX_FEATHER_Y / kNumInscriptionsToDisplayVertical) + 1; |
| 23246 | |
| 23247 | const auto drawerSlotsFrame = drawerFrame->addFrame("drawer slots"); |
| 23248 | drawerSlotsFrame->setSize(featherSlotsPos); |
| 23249 | drawerSlotsFrame->setActualSize(SDL_Rect{ 0, 0, featherSlotsPos.w, (200 + 2) * numGrids }); |
| 23250 | drawerSlotsFrame->setHollow(true); |
| 23251 | drawerSlotsFrame->setAllowScrollBinds(false); |
| 23252 | drawerSlotsFrame->setScrollBarsEnabled(false); |
| 23253 | |
| 23254 | auto gridImg = drawerSlotsFrame->addImage(SDL_Rect{ 0, 0, 174, 200 }, |
| 23255 | makeColor(255, 255, 255, 255), "*images/ui/Feather/Feather_ScrollGrid_00.png", "grid img"); |
| 23256 | gridImg->tiled = true; |
| 23257 | |
| 23258 | const int inventorySlotSize = players[player]->inventoryUI.getSlotSize(); |
| 23259 | SDL_Rect currentSlotPos{ baseSlotOffsetX, baseSlotOffsetY, inventorySlotSize, inscriptionSlotHeight }; |
| 23260 | for ( int x = 0; x < MAX_FEATHER_X; ++x ) |
| 23261 | { |
| 23262 | currentSlotPos.x = baseSlotOffsetX; |
| 23263 | for ( int y = 0; y < MAX_FEATHER_Y; ++y ) |
| 23264 | { |
| 23265 | currentSlotPos.y = baseSlotOffsetY + (y * inscriptionSlotHeight); |
| 23266 | |
| 23267 | char slotname[32] = ""; |
| 23268 | snprintf(slotname, sizeof(slotname), "feather %d %d", x, y); |
| 23269 | auto listEntry = drawerSlotsFrame->addFrame(slotname); |
| 23270 | listEntry->setSize(SDL_Rect{ currentSlotPos.x, currentSlotPos.y, gridImg->pos.w, inscriptionSlotHeight }); |
nothing calls this directly
no test coverage detected