From: otta8634 Date: Tue, 31 Dec 2024 16:45:22 +0000 (+0800) Subject: Add horizontal padding to guide descriptions X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aafde57c65e0581d1fd7427eee8437ea3175ff67;p=xonotic%2Fxonotic-data.pk3dir.git Add horizontal padding to guide descriptions Looked crammed beforehand. Used `1 - 2 * this.realFontSize.x`, which seems to be used in several other places in the code. --- diff --git a/qcsrc/menu/xonotic/guide/description.qc b/qcsrc/menu/xonotic/guide/description.qc index 64ab10840..bf198cc8d 100644 --- a/qcsrc/menu/xonotic/guide/description.qc +++ b/qcsrc/menu/xonotic/guide/description.qc @@ -3,7 +3,7 @@ void XonoticGuideDescription_drawListBoxItem(entity this, int i, vector absSize, bool isSelected, bool isFocused) { tokenizebyseparator(this.descriptionWrapped, "\n"); - draw_Text(this.realUpperMargin * eY, argv(i), this.realFontSize, '1 1 1', 1, true); + draw_Text(this.realFontSize.x * eX + this.realUpperMargin * eY, argv(i), this.realFontSize, '1 1 1', 1, true); } void XonoticGuideDescription_setDescription(entity this, string desc) @@ -16,13 +16,16 @@ void XonoticGuideDescription_setDescription(entity this, string desc) string currentWrapped = this.descriptionWrapped; if (currentWrapped) strunzone(currentWrapped); + string wrapped = ""; + // horizontal padding is this.realFontSize.x on both sides + float maxWidth = 1 - 2 * this.realFontSize.x; for (int i = 0, n = tokenizebyseparator(desc, "\n"); i < n; ++i) { string line = ""; for (getWrappedLine_remaining = argv(i); getWrappedLine_remaining; ) { - string s = getWrappedLine(1, this.realFontSize, draw_TextWidth_WithColors); + string s = getWrappedLine(maxWidth, this.realFontSize, draw_TextWidth_WithColors); line = strcat(line, "\n", s); } wrapped = strcat(wrapped, line);