From 41df73bafcb85b60e697c57cd358665cefb3b5cf Mon Sep 17 00:00:00 2001 From: tali Date: Wed, 14 Dec 2022 15:29:00 -0500 Subject: [PATCH] Export Movement and some useful Movement aliases --- mino/src/input.rs | 7 +++++++ mino/src/lib.rs | 1 + 2 files changed, 8 insertions(+) diff --git a/mino/src/input.rs b/mino/src/input.rs index 8869be6..d88002a 100644 --- a/mino/src/input.rs +++ b/mino/src/input.rs @@ -20,6 +20,13 @@ pub enum Movement { } impl Movement { + pub const DROP: Movement = Movement::Drop; + pub const LEFT: Movement = Movement::Shift(Horizontal::Left); + pub const RIGHT: Movement = Movement::Shift(Horizontal::Right); + pub const CW: Movement = Movement::Rotate(Spin::Cw); + pub const CCW: Movement = Movement::Rotate(Spin::Ccw); + pub const FLIP: Movement = Movement::Rotate(Spin::Flip); + /// Applies this movement to the given piece on the given matrix. Returns true if the /// movement was successful, or false if the piece did not move because it was /// obstructed by the matrix. `piece` will be modified in-place iff the return value diff --git a/mino/src/lib.rs b/mino/src/lib.rs index f247f52..42c18a2 100644 --- a/mino/src/lib.rs +++ b/mino/src/lib.rs @@ -4,6 +4,7 @@ pub mod input; pub mod matrix; pub mod piece; +pub use input::Movement; pub use matrix::Mat; pub use piece::{Loc, Piece, Rot};