#![no_std]
extern crate alloc;
use ::core::{fmt, mem::ManuallyDrop};
#[doc(hidden)]
pub use {
alloc::{string::String, vec::Vec, vec, boxed::Box, rc::Rc, format},
lmfu::{
arcstr::{ArcStr, literal as ro_string},
hash_map::HashMap, LiteMap, self,
},
};
pub mod core;
pub mod builtin;
pub const NOTO_SANS: &'static [u8] = include_bytes!("noto-sans.ttf");
pub(crate) const DEFAULT_FONT_NAME: ManuallyDrop<ArcStr> = ManuallyDrop::new(ro_string!("default-font"));
pub(crate) const DEFAULT_FONT_SIZE: ManuallyDrop<ArcStr> = ManuallyDrop::new(ro_string!("24"));
pub(crate) const FALSE_STR: ManuallyDrop<ArcStr> = ManuallyDrop::new(ro_string!("false"));
pub(crate) const ZERO_ARCSTR: ManuallyDrop<ArcStr> = ManuallyDrop::new(ro_string!("0"));
pub(crate) const ONE_ARCSTR: ManuallyDrop<ArcStr> = ManuallyDrop::new(ro_string!("1"));
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Error {
pub line: u32,
pub file: &'static str,
pub msg: Option<String>,
}
impl Error {
pub fn new(line: u32, file: &'static str, msg: Option<String>) -> Self {
Self { line, file, msg }
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self.msg {
Some(msg) => write!(f, "{}, line {}: {}", self.file, self.line, msg),
None => write!(f, "{}, line {}: unknown error", self.file, self.line),
}
}
}
#[macro_export]
macro_rules! error {
() => { $crate::Error::new(::core::line!(), ::core::file!(), None) };
($($arg:tt)*) => { $crate::Error::new(::core::line!(), ::core::file!(), Some($crate::format!($($arg)*))) };
}
pub const SSAA_SQ: usize = SSAA * SSAA;
pub const TEXT_SSAA_SQ: usize = TEXT_SSAA * TEXT_SSAA;
mod features;
#[doc(inline)]
pub use features::{SSAA, TEXT_SSAA};