aboutsummaryrefslogtreecommitdiffstats
path: root/src/font.rs
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar /dev/urandom <johnfkennedymaili2p>2025-02-15 01:46:19 +0100
committerLibravatarLarge Libravatar /dev/urandom <johnfkennedymaili2p>2025-02-15 01:46:19 +0100
commitf12e249c73f021d57d69d5f93d27e03259982edf (patch)
treed78de03146356df5c965433cc4f7f53b9f62579e /src/font.rs
parenta903bb7268fb95ea525a24bc8dd251e00312e149 (diff)
downloadcosin25-invite-mountainbytes-f12e249c73f021d57d69d5f93d27e03259982edf.tar.gz
cosin25-invite-mountainbytes-f12e249c73f021d57d69d5f93d27e03259982edf.tar.bz2
cosin25-invite-mountainbytes-f12e249c73f021d57d69d5f93d27e03259982edf.tar.lz
cosin25-invite-mountainbytes-f12e249c73f021d57d69d5f93d27e03259982edf.zip

feat: Marquee, Lower dither opacity at top, DVD Logo should be separate function, Release Builds should work, advance_width should be f64 to save bytes, Vendor Micromod-RS, Add Timing Steps

Diffstat (limited to 'src/font.rs')
-rw-r--r--src/font.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/font.rs b/src/font.rs
index 1dddd20..7041634 100644
--- a/src/font.rs
+++ b/src/font.rs
@@ -1,5 +1,3 @@
-use std::sync::LazyLock;
-
use sdl2::{
pixels::{Color, PixelFormatEnum},
rect::{Point, Rect},
@@ -17,8 +15,8 @@ pub struct RenderableCharacter {
pub data: &'static [u8],
/** The offset to draw the character at */
pub offset: Point,
- /** The amount to advance the x position of the cursor when drawing */
- pub advance_width: f32,
+ /** The amount to advance the x position of the cursor when drawing - f64 due to internally being used as a f64, despite being stored as f32 (only f64 to save some cpu cycles converting f32->f64) */
+ pub advance_width: f64,
}
/**
A trait describing a generated font.
@@ -34,9 +32,9 @@ pub trait BakedFont {
let width = u16::from_le_bytes(bytes[0..2].try_into().unwrap());
let offset_x = i32::from_le_bytes(bytes[2..6].try_into().unwrap());
let offset_y = i32::from_le_bytes(bytes[6..10].try_into().unwrap());
- let advance_width = f32::from_le_bytes(bytes[10..14].try_into().unwrap());
+ let advance_width = f64::from(f32::from_le_bytes(bytes[10..14].try_into().unwrap()));
let data = &bytes[14..];
- let height = if data.len() == 0 {
+ let height = if data.is_empty() {
0
} else {
data.len() as u16 / width