store size in tex instead of bot_right

This commit is contained in:
2025-11-21 14:38:16 -05:00
parent c428de8fd5
commit 97b284e81e
5 changed files with 34 additions and 17 deletions

View File

@@ -157,8 +157,8 @@ impl TextData {
}
TextTexture {
handle: textures.add(image),
top_left: Vec2::new(min_x as f32, min_y as f32),
bot_right: Vec2::new(max_width - max_x as f32, height - max_y as f32),
top_left_offset: Vec2::new(min_x as f32, min_y as f32),
size: Vec2::new(max_width, height),
}
}
}
@@ -166,12 +166,7 @@ impl TextData {
#[derive(Clone)]
pub struct TextTexture {
pub handle: TextureHandle,
pub top_left: Vec2,
pub bot_right: Vec2,
pub top_left_offset: Vec2,
pub size: Vec2,
}
impl TextTexture {
pub fn size(&self) -> Vec2 {
self.handle.size() - self.top_left + self.bot_right
}
}