parent
4f76f301bc
commit
1487614e86
@ -0,0 +1,27 @@ |
|||||||
|
use antf::lib::screen::init_screen; |
||||||
|
use antf::lib::world::{World, simulate, render}; |
||||||
|
use antf::lib::entity::{Entities, FoodGenerator}; |
||||||
|
|
||||||
|
use ncurses::*; |
||||||
|
use std::thread::sleep; |
||||||
|
use std::time; |
||||||
|
|
||||||
|
#[test] |
||||||
|
fn test_foodgen() { |
||||||
|
let mut board = init_screen();
|
||||||
|
let mut world = World::new(); |
||||||
|
|
||||||
|
let mut entities = Entities::new(); |
||||||
|
let fg = FoodGenerator::new(); |
||||||
|
entities.add_entity(&fg); |
||||||
|
|
||||||
|
for _ in 0..60 { |
||||||
|
// TODO: add way to break out of the loop by hitting a random key
|
||||||
|
simulate(&mut entities, &mut world, &mut board); |
||||||
|
render(&entities, &world, &board); |
||||||
|
sleep(time::Duration::from_millis(100)); |
||||||
|
refresh(); |
||||||
|
} |
||||||
|
clear(); |
||||||
|
endwin(); |
||||||
|
} |
Loading…
Reference in new issue