@@ 20,6 20,8 @@ enum GameState {
fn main() {
let rl = raylib::init().size(640, 480).title("Simon Says").build();
+ rl.set_target_fps(60);
+
let mut state = GameState::WelcomeScreen;
let mut colors: Vec<SimonColor> = vec![];
let mut userinputs: Vec<SimonColor> = vec![];
@@ 28,7 30,7 @@ fn main() {
}
let mut pos_in_seq = 0;
- let wait_dura: time::Duration = time::Duration::from_millis(2000);
+ let wait_dura = time::Duration::from_millis(2000);
let mut starttime = time::Instant::now();
while !rl.window_should_close() {
@@ 64,9 66,11 @@ fn main() {
GameState::UserInput => {
if rl.is_mouse_button_pressed(0) {
userinputs.push(button_lookup(rl.get_mouse_position()));
- for i in 0..colors.len() {
+ for i in 0..userinputs.len() {
+ println!("{:?}\n {:?}", colors, userinputs);
if colors[i] != userinputs[i] {
rl.draw_text(" - WRONG -", 150, 40, 60, Color::RED);
+ std::process::exit(1);
}
}
}