diff options
author | Tom Barrett <tombarrett@siu.edu> | 2017-11-02 08:36:26 -0500 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-11-02 08:36:26 -0500 |
commit | 1c3ec15a9a8b7cef3c544af225d028b3de13d75e (patch) | |
tree | 33eb2512060caf7296849ce99dcb0bb920c94aee /src/main.rs | |
parent | 2e5f1363e6efff3daefee9fe6388be2332e6fb62 (diff) |
- added color constants, fixed some syntax, and changed method of
getting potential locations
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 9 insertions, 7 deletions
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()); |