shark/mino/src/lib.rs

41 lines
807 B
Rust

#![no_std]
pub mod input;
pub mod matrix;
pub mod piece;
pub use input::Movement;
pub use matrix::{Mat, MatBuf};
pub use piece::{Loc, Piece, Rot};
#[cfg(feature = "srs")]
pub mod srs;
/// Allows constructing a `Mat` constant with string literals:
///
/// ```
/// # use mino::{mat, Mat};
/// # const MAT: &Mat =
/// mat! {
/// ".......xxx"; // top row (y=2)
/// "x.xxxxxxxx"; // middle row (y=1)
/// "xxxx.xxxxx"; // bottom row (y=0)
/// }
/// # ;
/// ```
#[cfg(any(feature = "ascii", test))]
#[macro_export]
macro_rules! mat {
($($row:literal);* $(;)?) => {
({
const MAT: &$crate::matrix::Mat = $crate::matrix::Mat::new(
&$crate::matrix::__ascii::parse([$($row),*]),
);
MAT
})
}
}
#[cfg(test)]
extern crate alloc;