Freiheit, Ehrenhalle, Götter, Champion-Auftritte; Waffen weichen dem Körper aus
Stand von main 0abffe17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,25 @@ namespace GladiatorIdle.Gfx
|
||||
font.DrawText(sb, text, p, c, scale: s);
|
||||
}
|
||||
|
||||
/// Text mit Zeilenumbruch an Wortgrenzen innerhalb von <paramref name="r"/> (oben links beginnend).
|
||||
public static void TextWrap(SpriteBatch sb, FontSystem fs, float px, string text, RectangleF r, Color c)
|
||||
{
|
||||
float y = r.Y + px * 0.6f, lineH = px * 1.3f;
|
||||
string line = "";
|
||||
foreach (var word in text.Split(' '))
|
||||
{
|
||||
string next = line.Length == 0 ? word : line + " " + word;
|
||||
if (line.Length > 0 && Measure(fs, px, next).X > r.Width)
|
||||
{
|
||||
if (y > r.Bottom) return;
|
||||
Text(sb, fs, px, line, new Vector2(r.X, y), c);
|
||||
y += lineH; line = word;
|
||||
}
|
||||
else line = next;
|
||||
}
|
||||
if (line.Length > 0 && y <= r.Bottom + lineH) Text(sb, fs, px, line, new Vector2(r.X, y), c);
|
||||
}
|
||||
|
||||
/// Balken mit verzögertem Rest (weißer Abschnitt zeigt den gerade verlorenen Teil).
|
||||
public static void Bar(SpriteBatch sb, RectangleF r, float value, float lag, Color c, bool fromRight = false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user