summaryrefslogtreecommitdiff
path: root/pixel-client/src/render/font.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-25 13:50:09 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-25 13:50:09 +0200
commitecb6ff15c24841dc08ab8f5c3b347c8080720ac4 (patch)
treed53db2a61a6151af970f9d27a617d12e0cac7588 /pixel-client/src/render/font.rs
parentbc210b2632891ca163d31fb57bc0c41769249bf5 (diff)
downloadhurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar
hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar.bz2
hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar.zst
pc: main menu background
Diffstat (limited to 'pixel-client/src/render/font.rs')
-rw-r--r--pixel-client/src/render/font.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/pixel-client/src/render/font.rs b/pixel-client/src/render/font.rs
index ff4abade..392c1d66 100644
--- a/pixel-client/src/render/font.rs
+++ b/pixel-client/src/render/font.rs
@@ -25,8 +25,9 @@ impl FontTextures {
}
impl<'a> Renderer<'a> {
- pub fn draw_text(&mut self, position: Vec2, text: &str) {
+ pub fn draw_text(&mut self, position: Vec2, text: &str) -> Vec2 {
let mut cursor = position;
+ let mut line_height = 0f32;
for c in text.chars() {
if (c as u32) < 128 {
let r = self.font_textures.glyphs[c as usize];
@@ -37,7 +38,9 @@ impl<'a> Renderer<'a> {
None,
));
cursor.x += r.width() as f32;
+ line_height = line_height.max(r.height() as f32)
}
}
+ cursor + Vec2::Y * line_height
}
}