summaryrefslogtreecommitdiff
path: root/src/list.rs
diff options
context:
space:
mode:
authorTom Barrett <tombarrett@siu.edu>2017-10-23 11:57:59 -0500
committerTom Barrett <tombarrett@siu.edu>2017-10-23 11:57:59 -0500
commit1e77601579065df48a9b1d9daa9dba46522842ca (patch)
treeb6ad932cd3fb9c838c85b6c918c16769f00d7139 /src/list.rs
-decent starting point, but centering does not seem to be working
Diffstat (limited to 'src/list.rs')
-rw-r--r--src/list.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/list.rs b/src/list.rs
new file mode 100644
index 0000000..cdf00a8
--- /dev/null
+++ b/src/list.rs
@@ -0,0 +1,36 @@
+extern crate pancurses;
+
+use character::Character;
+use location::Location;
+
+pub struct List{
+ men : Vec<Character>,
+ impassable : Vec<Location>,
+}
+
+impl List{
+ pub fn new(impassable : Vec<Location>) -> List {
+ let mut men = Vec::new();
+ for i in 0..3 {
+ let l = Location{x:150,y:150+i};
+ let c = Character::new('@',4,l);
+ men.push(c);
+ }
+ List{
+ men : men,
+ impassable : impassable,
+ }
+ }
+
+ pub fn draw(&self, window : &pancurses::Window) {
+ for man in self.men.iter(){
+ man.draw(window);
+ }
+ }
+
+ pub fn action(&self) {
+ for man in self.men.iter(){
+ man.action(self.men.to_vec(), self.impassable.to_vec());
+ }
+ }
+}