summaryrefslogtreecommitdiff
path: root/src/map.rs
diff options
context:
space:
mode:
authorTom Barrett <tombarrett@siu.edu>2017-11-24 01:31:41 -0600
committerTom Barrett <tombarrett@siu.edu>2017-11-24 01:31:41 -0600
commita853a837b8cb991d8c55496401bef02275139c4e (patch)
tree0b436b49c15ead9cb572fcb6796bed49cafa8a68 /src/map.rs
parentfb20a0f84419dab4c8949d9a9ca30d3b75f9665c (diff)
-added giving a grid placement order
Diffstat (limited to 'src/map.rs')
-rw-r--r--src/map.rs27
1 files changed, 27 insertions, 0 deletions
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() {