diff options
| author | troido <troido@protonmail.com> | 2020-01-31 00:51:48 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-01-31 00:51:48 +0100 |
| commit | 5e414fb932eee5aa90d2181cada3c6cd32e4ec09 (patch) | |
| tree | 8d9fd198525e0c52fcd43e03215d3a377d84d97c /src/main.rs | |
| parent | 286be37225b5de1fb438db0a4029fd391b35c13e (diff) | |
systems can create entities (sort of)
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs index 9b313be..abf6039 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ pub mod components; pub mod resources; pub mod systems; -use self::gameserver::{GameServer, Action}; +use self::gameserver::GameServer; use self::server::unixserver::UnixServer; use self::server::tcpserver::TcpServer; use self::server::Server; @@ -37,19 +37,14 @@ fn main() { let mut gameserver = GameServer::new(servers); - let mut room = room::Room::new((32, 32)); + let mut room = room::Room::new((50, 50)); gen_room(&mut room); loop { let actions = gameserver.update(); - for action in actions { - match action { - Action::Join(name) => {room.add_player(&name, &Player::new(&name));} - Action::Leave(name) => {room.remove_player(&name);} - Action::Input(name, control) => {room.control(name, control);} - } - } + + room.set_input(actions); room.update(); let (field, mapping) = room.view(); let updatemsg = create_update_message(room.get_size(), field, mapping); @@ -61,13 +56,14 @@ fn main() { fn gen_room(room: &mut room::Room){ let (width, height) = room.get_size(); + let wall = Wall{}; for x in 0..width { - room.add_obj(&Wall, (x, 0)); - room.add_obj(&Wall, (x, height - 1)); + room.add_obj(&wall, (x, 0)); + room.add_obj(&wall, (x, height - 1)); } for y in 1..height-1 { - room.add_obj(&Wall, (0, y)); - room.add_obj(&Wall, (width - 1, y)); + room.add_obj(&wall, (0, y)); + room.add_obj(&wall, (width - 1, y)); } for x in 1..width-1 { for y in 1..height-1 { |
