| 1224 | } |
| 1225 | |
| 1226 | void MainInterface::renderMainBar() { |
| 1227 | Vec2I barPos = mainBarPosition(); |
| 1228 | |
| 1229 | m_cursorTooltip = {}; |
| 1230 | |
| 1231 | auto assets = Root::singleton().assets(); |
| 1232 | |
| 1233 | Vec2I inventoryButtonPos = barPos + m_config->mainBarInventoryButtonOffset * interfaceScale(); |
| 1234 | if (m_paneManager.registeredPaneIsDisplayed(MainInterfacePanes::Inventory)) { |
| 1235 | if (overButton(m_config->mainBarInventoryButtonPoly, m_cursorScreenIPos)) { |
| 1236 | m_guiContext->drawQuad(m_config->inventoryImageOpenHover, Vec2F(inventoryButtonPos), interfaceScale()); |
| 1237 | m_cursorTooltip = assets->json("/interface.config:cursorTooltip.inventoryText").toString(); |
| 1238 | } else { |
| 1239 | m_guiContext->drawQuad(m_config->inventoryImageOpen, Vec2F(inventoryButtonPos), interfaceScale()); |
| 1240 | } |
| 1241 | } else if (overButton(m_config->mainBarInventoryButtonPoly, m_cursorScreenIPos)) { |
| 1242 | if (m_inventoryWindow->containsNewItems()) |
| 1243 | m_guiContext->drawQuad(m_config->inventoryImageGlowHover, Vec2F(inventoryButtonPos), interfaceScale()); |
| 1244 | else |
| 1245 | m_guiContext->drawQuad(m_config->inventoryImageHover, Vec2F(inventoryButtonPos), interfaceScale()); |
| 1246 | m_cursorTooltip = assets->json("/interface.config:cursorTooltip.inventoryText").toString(); |
| 1247 | } else { |
| 1248 | if (m_inventoryWindow->containsNewItems()) |
| 1249 | m_guiContext->drawQuad(m_config->inventoryImageGlow, Vec2F(inventoryButtonPos), interfaceScale()); |
| 1250 | else |
| 1251 | m_guiContext->drawQuad(m_config->inventoryImage, Vec2F(inventoryButtonPos), interfaceScale()); |
| 1252 | } |
| 1253 | |
| 1254 | auto drawStateButton = [this](MainInterfacePanes paneType, Vec2I pos, PolyI poly, |
| 1255 | String image, String hoverImage, String openImage, String hoverOpenImage, String toolTip) { |
| 1256 | if (m_paneManager.registeredPaneIsDisplayed(paneType)) { |
| 1257 | if (overButton(poly, m_cursorScreenIPos)) { |
| 1258 | m_guiContext->drawQuad(hoverOpenImage, Vec2F(pos), interfaceScale()); |
| 1259 | m_cursorTooltip = toolTip; |
| 1260 | } else { |
| 1261 | m_guiContext->drawQuad(openImage, Vec2F(pos), interfaceScale()); |
| 1262 | } |
| 1263 | } else if (overButton(poly, m_cursorScreenIPos)) { |
| 1264 | m_guiContext->drawQuad(hoverImage, Vec2F(pos), interfaceScale()); |
| 1265 | m_cursorTooltip = toolTip; |
| 1266 | } else { |
| 1267 | m_guiContext->drawQuad(image, Vec2F(pos), interfaceScale()); |
| 1268 | } |
| 1269 | }; |
| 1270 | |
| 1271 | Vec2I craftButtonPos = barPos + m_config->mainBarCraftButtonOffset * interfaceScale(); |
| 1272 | drawStateButton(MainInterfacePanes::CraftingPlain, |
| 1273 | craftButtonPos, |
| 1274 | m_config->mainBarCraftButtonPoly, |
| 1275 | m_config->craftImage, |
| 1276 | m_config->craftImageHover, |
| 1277 | m_config->craftImageOpen, |
| 1278 | m_config->craftImageOpenHover, |
| 1279 | assets->json("/interface.config:cursorTooltip.craftingText").toString()); |
| 1280 | |
| 1281 | Vec2I codexButtonPos = barPos + m_config->mainBarCodexButtonOffset * interfaceScale(); |
| 1282 | drawStateButton(MainInterfacePanes::Codex, |
| 1283 | codexButtonPos, |
nothing calls this directly
no test coverage detected