pub struct MessageManager {
defs: Vec<MessageDef>,
slot_to_index: HashMap<u32, usize>,
active: Vec<ActiveMessage>,
cycle_cursor: usize,
transient_default: MessageDef,
}Expand description
Message system: definitions + active instances + cycle cursor.
Fields§
§defs: Vec<MessageDef>§slot_to_index: HashMap<u32, usize>§active: Vec<ActiveMessage>§cycle_cursor: usizeCursor for the T keybind. Walks the defs vec mod len.
transient_default: MessageDefFallback styling used by Self::show_transient when no
MILK_MSG.INI is loaded. Centred, white, 32 px, 0.5 s
fade-in / fade-out, 4 s sustain.
Implementations§
Source§impl MessageManager
impl MessageManager
pub fn new() -> Self
Sourcepub fn load_defs(&mut self, defs: Vec<MessageDef>)
pub fn load_defs(&mut self, defs: Vec<MessageDef>)
Load a freshly-parsed set of message definitions, replacing any previous load. Doesn’t touch the active list.
pub fn def_count(&self) -> usize
pub fn active_count(&self) -> usize
Sourcepub fn spawn_slot(&mut self, slot: u32, time: f32) -> bool
pub fn spawn_slot(&mut self, slot: u32, time: f32) -> bool
Spawn a message by INI slot at time. Multiple spawns of the
same slot stack — matches the sprite manager + MD2 behaviour.
Sourcepub fn cycle_next(&mut self, time: f32) -> Option<u32>
pub fn cycle_next(&mut self, time: f32) -> Option<u32>
T keybind: cycle to the next loaded slot.
Sourcepub fn show_transient(&mut self, text: impl Into<String>, time: f32)
pub fn show_transient(&mut self, text: impl Into<String>, time: f32)
Show a transient message — used by the MPRIS auto-title path.
Reuses the first loaded def’s style (font, size, colour,
position, fade timing) so user-authored typography sticks; if
no def is loaded, the built-in transient_default is used.
The text argument overrides the def’s text= field.
Sourcepub fn tick(&mut self, time: f32) -> Vec<MessageRenderInstance>
pub fn tick(&mut self, time: f32) -> Vec<MessageRenderInstance>
Advance every active message by one tick at engine time
time. Returns the list of MessageRenderInstances for the
renderer, sorted in spawn order so later messages paint over
earlier ones.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessageManager
impl RefUnwindSafe for MessageManager
impl Send for MessageManager
impl Sync for MessageManager
impl Unpin for MessageManager
impl UnwindSafe for MessageManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().