From 4522a97f9c20cefd7361db3df0a17cda1a097cb1 Mon Sep 17 00:00:00 2001 From: Corwin Date: Sat, 13 Apr 2024 23:38:09 +0100 Subject: [PATCH] remove line popping --- agb/src/display/object/font.rs | 25 ----------------------- agb/src/display/object/font/preprocess.rs | 11 ---------- 2 files changed, 36 deletions(-) diff --git a/agb/src/display/object/font.rs b/agb/src/display/object/font.rs index 36e89134a..fab2d7b21 100644 --- a/agb/src/display/object/font.rs +++ b/agb/src/display/object/font.rs @@ -392,31 +392,6 @@ impl ObjectTextRender<'_> { ); } - /// Removes one complete line. Returns whether a line could be removed. You must call [`update`][ObjectTextRender::update] after this - pub fn pop_line(&mut self) -> bool { - let width = self.layout.area.x; - let space = self.buffer.font.letter(' ').advance_width as i32; - let line_height = self.buffer.font.line_height(); - if let Some(line) = self.buffer.preprocessor.lines(width, space).next() { - // there is a line - if self.number_of_objects >= line.number_of_letter_groups() { - // we have enough rendered letter groups to count - self.number_of_objects -= line.number_of_letter_groups(); - for _ in 0..line.number_of_letter_groups() { - self.buffer.letters.letters.pop_front(); - self.layout.relative_positions.pop_front(); - } - self.layout.line_capacity.pop_front(); - self.buffer.preprocessor.pop(&line); - for position in self.layout.relative_positions.iter_mut() { - position.y -= line_height as i16; - } - return true; - } - } - false - } - /// Updates the internal state of the number of letters to write and popped /// line. Should be called in the same frame as and after /// [`next_letter_group`][ObjectTextRender::next_letter_group], [`next_line`][ObjectTextRender::next_line], and [`pop_line`][ObjectTextRender::pop_line]. diff --git a/agb/src/display/object/font/preprocess.rs b/agb/src/display/object/font/preprocess.rs index e07356a2b..8adfe17ed 100644 --- a/agb/src/display/object/font/preprocess.rs +++ b/agb/src/display/object/font/preprocess.rs @@ -117,10 +117,6 @@ impl Line { self.width } #[inline(always)] - pub(crate) fn number_of_text_elements(&self) -> usize { - self.number_of_text_elements - } - #[inline(always)] pub(crate) fn number_of_spaces(&self) -> usize { self.number_of_spaces } @@ -215,13 +211,6 @@ impl Preprocessed { .add_character(font, c, sprite_width, &mut self.widths); } - pub(crate) fn pop(&mut self, line: &Line) { - let elements = line.number_of_text_elements(); - for _ in 0..elements { - self.widths.pop_front(); - } - } - pub(crate) fn lines(&self, layout_width: i32, minimum_space_width: i32) -> Lines<'_> { Lines { minimum_space_width,