296c99f059
Fixes #11
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
use std::{
|
|
error::Error,
|
|
fmt::{self, Display, Formatter},
|
|
};
|
|
|
|
/// An error that occurred while preparing text for rendering.
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum PrepareError {
|
|
AtlasFull,
|
|
}
|
|
|
|
impl Display for PrepareError {
|
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
|
write!(f, "Prepare error: glyph texture atlas is full")
|
|
}
|
|
}
|
|
|
|
impl Error for PrepareError {}
|
|
|
|
/// An error that occurred while rendering text.
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum RenderError {
|
|
RemovedFromAtlas,
|
|
ScreenResolutionChanged,
|
|
}
|
|
|
|
impl Display for RenderError {
|
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
|
match self {
|
|
RenderError::RemovedFromAtlas => {
|
|
write!(
|
|
f,
|
|
"Render error: glyph no longer exists within the texture atlas"
|
|
)
|
|
}
|
|
RenderError::ScreenResolutionChanged => write!(
|
|
f,
|
|
"Render error: screen resolution changed since last `prepare` call"
|
|
),
|
|
}
|
|
}
|
|
}
|