diff --git a/src/apr.rs b/src/apr.rs index 8d3e78a..118663f 100644 --- a/src/apr.rs +++ b/src/apr.rs @@ -36,13 +36,7 @@ pub fn make_grid(ctx: &mut Context, r: u8, c: u8, board: &[Vec]) -> GameResu 0 => Color::WHITE, 1 => Color::BLACK, _ => Color::BLACK, //impossible - /* 2 => Color::RED, - 3 => Color::CYAN, - 4 => Color::YELLOW, - 5 => Color::GREEN, - 6 => Color::BLUE, - 7 => Color::MAGENTA, - _ => Color::BLACK,*/ + //2 => Color::RED, 3 => Color::CYAN, 4 => Color::YELLOW, 5 => Color::GREEN, 6 => Color::BLUE, 7 => Color::MAGENTA, _ => Color::BLACK, }, )?; } @@ -60,16 +54,25 @@ impl Apr { board: board, should_update_grid: false, - actors: vec![actor::Actor { + /*actors: vec![actor::Actor { image: graphics::Image::new(_ctx, "/pawn.png")?, posn: actor::ActorPosn::BoardPosn { x: 0, y: 0 }, behaviour: 0, - }], + }],*/ + actors: vec![Apr::make_actor(_ctx, "/pawn.png", 0, 0, 0)], behaviours: vec![behaviour::Behaviour { moves: vec![(0, 1)], }], //the pawn can go ONE forwards }) } + + pub fn make_actor(ctx: &mut Context, img_path: &str, _x: u8, _y: u8, b: u8) -> actor::Actor { + return actor::Actor { + image: graphics::Image::new(ctx, img_path).unwrap(), + posn: actor::ActorPosn::BoardPosn { x: _x, y: _y }, + behaviour: b, + }; + } pub fn set_colour(&mut self, r: usize, c: usize, col: u8) { //You should only modify self.board through this method.