int UI_DrawString (const char* fontID, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char* c, int boxHeight, int scrollPos, int* curLine, bool increaseLine, longlines_t method) { const uiFont_t* font = UI_GetFontByID(fontID); const align_t verticalAlign = (align_t)(align / 3); /* top, center, bottom */ int lines; if (!font) Com_Error(ERR_FATAL, "Could not find font with id: '%s'", fontID); if (lineHeight <= 0) lineHeight = UI_FontGetHeight(font->name); /* vertical alignment makes only a single-line adjustment in this * function. That means that ALIGN_Lx values will not show more than * one line in any case. */ if (verticalAlign == 1) y += -(lineHeight / 2); else if (verticalAlign == 2) y += -lineHeight; lines = R_FontDrawString(fontID, align, x, y, absX, maxWidth, lineHeight, c, boxHeight, scrollPos, curLine, method); if (curLine && increaseLine) *curLine += lines; return lines * lineHeight; }
/** * @brief Draw the inventory of the base */ static void UI_BaseInventoryNodeDraw2 (uiNode_t* node, const objDef_t* highlightType) { bool updateScroll = false; int visibleHeight = 0; int needHeight = 0; vec2_t screenPos; UI_GetNodeScreenPos(node, screenPos); UI_PushClipRect(screenPos[0], screenPos[1], node->box.size[0], node->box.size[1]); needHeight = UI_BaseInventoryNodeDrawItems(node, highlightType); UI_PopClipRect(); visibleHeight = node->box.size[1]; #if 0 R_FontDrawString("f_verysmall", ALIGN_UL, node->box.pos[0], node->box.pos[1], node->box.pos[0], node->box.pos[1], 0, 0, /* maxWidth/maxHeight */ 0, va("%i %i/%i", EXTRADATA(node).scrollCur, visibleRows, totalRows), 0, 0, nullptr, false, 0); #endif /* Update display of scroll buttons if something changed. */ if (visibleHeight != EXTRADATA(node).scrollY.viewSize || needHeight != EXTRADATA(node).scrollY.fullSize) { EXTRADATA(node).scrollY.fullSize = needHeight; EXTRADATA(node).scrollY.viewSize = visibleHeight; updateScroll = true; } if (EXTRADATA(node).scrollY.viewPos > needHeight - visibleHeight) { EXTRADATA(node).scrollY.viewPos = needHeight - visibleHeight; updateScroll = true; } if (EXTRADATA(node).scrollY.viewPos < 0) { EXTRADATA(node).scrollY.viewPos = 0; updateScroll = true; } if (updateScroll) UI_BaseInventoryNodeUpdateScroll(node); }