diff --git a/Cargo.lock b/Cargo.lock index ec71789..dfc21a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.9.0" @@ -32,6 +38,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.170" @@ -100,6 +112,30 @@ name = "reimtris2" version = "0.1.0" dependencies = [ "rand", + "sdl2", +] + +[[package]] +name = "sdl2" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b498da7d14d1ad6c839729bd4ad6fc11d90a57583605f3b4df2cd709a9cd380" +dependencies = [ + "bitflags 1.3.2", + "lazy_static", + "libc", + "sdl2-sys", +] + +[[package]] +name = "sdl2-sys" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "951deab27af08ed9c6068b7b0d05a93c91f0a8eb16b6b816a5e73452a43521d3" +dependencies = [ + "cfg-if", + "libc", + "version-compare", ] [[package]] @@ -119,6 +155,12 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" +[[package]] +name = "version-compare" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" + [[package]] name = "wasi" version = "0.13.3+wasi-0.2.2" @@ -198,7 +240,7 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" dependencies = [ - "bitflags", + "bitflags 2.9.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c803713..d07594c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" [dependencies] rand = "0.9.0" +sdl2 = "0.37.0" diff --git a/src/board.rs b/src/board.rs index 2bb29d2..058a0d2 100644 --- a/src/board.rs +++ b/src/board.rs @@ -1,6 +1,6 @@ use std::ops::{Deref, DerefMut}; -use crate::{CurrentTetromino, Tetromino}; +use crate::{game::CurrentTetromino, Tetromino}; #[derive(PartialEq)] pub struct Board([[Option; Self::WIDTH]; Self::HEIGHT]); diff --git a/src/game.rs b/src/game.rs index b2eeb36..6f030de 100644 --- a/src/game.rs +++ b/src/game.rs @@ -2,11 +2,11 @@ use crate::actions::{Controls, ControlsHeld}; use crate::board::Board; use crate::tetromino::{Direction, DirectionDiff, Tetromino}; -struct CurrentTetromino { - tetromino: Tetromino, - direction: Direction, - x: i8, - y: i8, +pub struct CurrentTetromino { + pub tetromino: Tetromino, + pub direction: Direction, + pub x: i8, + pub y: i8, } impl CurrentTetromino { @@ -258,7 +258,7 @@ impl Game { #[cfg(test)] mod test { - use crate::{Board, CurrentTetromino, Game, Score, Tetromino}; + use super::{Board, CurrentTetromino, Game, Score, Tetromino}; #[test] fn advance_bag() {