From a853a837b8cb991d8c55496401bef02275139c4e Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Fri, 24 Nov 2017 01:31:41 -0600 Subject: -added giving a grid placement order --- src/map.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/map.rs') diff --git a/src/map.rs b/src/map.rs index a108929..6546917 100644 --- a/src/map.rs +++ b/src/map.rs @@ -64,6 +64,33 @@ impl Map { self.window.mvaddch(character.location.0, character.location.1, character.symbol); } + pub fn draw_box(&self, first_location : Location, second_location : Location) { + for i in first_location.0..second_location.0 + 1 { + for j in first_location.1..second_location.1 + 1 { + self.window.attron(ColorPair(Colors::White as u8)); + self.window.mvaddch(i as i32, j as i32, 'X'); + } + } + for i in second_location.0..first_location.0 { + for j in second_location.1..first_location.1 { + self.window.attron(ColorPair(Colors::White as u8)); + self.window.mvaddch(i as i32, j as i32, 'X'); + } + } + for i in first_location.0..second_location.0 + 1 { + for j in second_location.1..first_location.1 { + self.window.attron(ColorPair(Colors::White as u8)); + self.window.mvaddch(i as i32, j as i32, 'X'); + } + } + for i in second_location.0..first_location.0 { + for j in first_location.1..second_location.1 + 1 { + self.window.attron(ColorPair(Colors::White as u8)); + self.window.mvaddch(i as i32, j as i32, 'X'); + } + } + } + pub fn fill(&mut self) { for (i, row) in self.map_data.iter().enumerate() { for (j, index) in row.chars().enumerate() { -- cgit v1.2.3