From 1c3ec15a9a8b7cef3c544af225d028b3de13d75e Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Thu, 2 Nov 2017 08:36:26 -0500 Subject: - added color constants, fixed some syntax, and changed method of getting potential locations --- src/main.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index bed39ec..ac74781 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,14 +4,16 @@ use pancurses::{initscr, endwin, noecho, start_color, Input, init_pair, COLOR_YE mod map; mod view; mod list; -mod character; mod location; +mod character; +mod constants; use map::Map; use view::View; use list::List; -use character::Character; use location::Location; +use character::Character; +use constants::Colors; fn init() -> pancurses::Window { let main = initscr(); @@ -21,10 +23,10 @@ fn init() -> pancurses::Window { curs_set(0); main.timeout(100); start_color(); - init_pair(1, COLOR_GREEN, COLOR_BLACK); - init_pair(2, COLOR_YELLOW, COLOR_BLACK); - init_pair(3, COLOR_WHITE, COLOR_WHITE); - init_pair(4, COLOR_WHITE, COLOR_BLUE); + init_pair(Colors::Grass as i16, COLOR_GREEN, COLOR_BLACK); + init_pair(Colors::Tree as i16, COLOR_YELLOW, COLOR_BLACK); + init_pair(Colors::White as i16, COLOR_WHITE, COLOR_WHITE); + init_pair(Colors::BlueUnit as i16, COLOR_WHITE, COLOR_BLUE); main } @@ -34,7 +36,7 @@ fn main() { let mut map = Map::new(); let mut view = View::new(main.get_max_yx(), &map.window); - let mut cursor = Character::new('X', 3, Location{x:150,y:150}); + let mut cursor = Character::new('X', Colors::White as u8, Location{ x : 150, y : 150}); let mut list = List::new(map.impassable.to_vec()); -- cgit v1.2.3