Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions fl16-inputmodules/src/animations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::control::*;
use crate::games::game_of_life::*;
use crate::games::pong_animation::*;
use crate::games::snake_animation::*;
use crate::games::tetris_animation::*;
use crate::matrix::Grid;
use crate::matrix::*;
use crate::patterns::*;
Expand All @@ -19,6 +20,7 @@ pub enum Animation {
Breathing(BreathingIterator),
Snake(SnakeIterator),
Pong(PongIterator),
Tetris(TetrisIterator)
}
impl Iterator for Animation {
type Item = Grid;
Expand All @@ -31,6 +33,7 @@ impl Iterator for Animation {
Animation::Breathing(x) => x.next(),
Animation::Snake(x) => x.next(),
Animation::Pong(x) => x.next(),
Animation::Tetris(x) => x.next()
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions fl16-inputmodules/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use is31fl3741::PwmFreq;

#[cfg(feature = "c1minimal")]
use smart_leds::{SmartLedsWrite, RGB8};
use crate::games::tetris;

#[repr(u8)]
#[derive(num_derive::FromPrimitive)]
Expand Down Expand Up @@ -351,7 +352,7 @@ pub fn parse_module_command(count: usize, buf: &[u8]) -> Option<Command> {
Some(CommandVals::StartGame) => match arg.and_then(FromPrimitive::from_u8) {
Some(GameVal::Snake) => Some(Command::StartGame(Game::Snake)),
Some(GameVal::Pong) => Some(Command::StartGame(Game::Pong)),
Some(GameVal::Tetris) => None,
Some(GameVal::Tetris) => Some(Command::StartGame(Game::Tetris)),
Some(GameVal::GameOfLife) => {
if count >= 5 {
FromPrimitive::from_u8(buf[4])
Expand Down Expand Up @@ -590,7 +591,7 @@ pub fn handle_command(
match game {
Game::Snake => snake::start_game(state, random),
Game::Pong => pong::start_game(state, random),
Game::Tetris => {}
Game::Tetris => {tetris::start_game(state, random)}
Game::GameOfLife(param) => game_of_life::start_game(state, random, *param),
}
None
Expand All @@ -599,6 +600,7 @@ pub fn handle_command(
match state.game {
Some(GameState::Snake(_)) => snake::handle_control(state, arg),
Some(GameState::Pong(_)) => pong::handle_control(state, arg),
Some(GameState::Tetris(_)) => tetris::handle_control(state, arg),
Some(GameState::GameOfLife(_)) => game_of_life::handle_control(state, arg),
_ => {}
}
Expand Down
2 changes: 2 additions & 0 deletions fl16-inputmodules/src/games/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ pub mod pong;
pub mod pong_animation;
pub mod snake;
pub mod snake_animation;
pub mod tetris;
pub mod tetris_animation;
Loading