Replace returning number of lines printed to x width

This commit is contained in:
Gwilym Kuiper 2022-04-05 22:49:34 +01:00
parent 6bea61bb7a
commit 8a1a433f99
2 changed files with 3 additions and 5 deletions

View file

@ -35,7 +35,7 @@ fn main(mut gba: agb::Gba) -> ! {
vram.remove_dynamic_tile(background_tile);
FONT.render_text(3, 3, "Hello, World!", 1, 2, 100, &mut bg, &mut vram);
FONT.render_text(3, 3, "Hello, World!", 1, 2, &mut bg, &mut vram);
bg.commit();
bg.show();

View file

@ -59,7 +59,6 @@ impl Font {
text: &str,
foreground_colour: u8,
background_colour: u8,
_max_width: i32,
bg: &mut RegularMap,
vram_manager: &mut VRamManager,
) -> i32 {
@ -89,13 +88,12 @@ impl Font {
};
let mut current_x_pos = 0i32;
let current_y_pos = 0i32;
for c in text.chars() {
let letter = self.letter(c);
let xmin = (current_x_pos + letter.xmin as i32).max(0);
let y_start = current_y_pos + self.ascent - letter.height as i32 - letter.ymin as i32;
let y_start = self.ascent - letter.height as i32 - letter.ymin as i32;
for letter_y in 0..(letter.height as i32) {
for letter_x in 0..(letter.width as i32) {
@ -125,6 +123,6 @@ impl Font {
}
}
1
current_x_pos
}
}