diff options
| author | Arne Dußin | 2021-02-03 16:26:59 +0100 |
|---|---|---|
| committer | Arne Dußin | 2021-02-03 16:26:59 +0100 |
| commit | 9ab689527b3ede7750579b1a926cf0cf88813463 (patch) | |
| tree | 959894450512ebb10e86ed62058da1d7039614ef /src/client/editor.rs | |
| parent | d4c1c7ecb5688ef64f45425d9ac8e7ddeb8e8602 (diff) | |
| download | graf_karto-9ab689527b3ede7750579b1a926cf0cf88813463.tar.gz graf_karto-9ab689527b3ede7750579b1a926cf0cf88813463.zip | |
Add capability to draw rooms
Diffstat (limited to 'src/client/editor.rs')
| -rw-r--r-- | src/client/editor.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/editor.rs b/src/client/editor.rs index 0fb5794..e416339 100644 --- a/src/client/editor.rs +++ b/src/client/editor.rs @@ -127,6 +127,8 @@ impl Editor { snapper: &Snapper, input: &mut Input, ) { + self.poll_net(); + // Handle keybindings for tool change for (&tool_type, (_, activation_bind)) in self.tools.iter() { if input.poll_global(&activation_bind) { @@ -163,6 +165,21 @@ impl Editor { active_tool.handle_custom_bindings(&mut self.map, &self.server, input); } + fn poll_net(&mut self) { + while let Some(cargo) = self.server().next_packet() { + match cargo { + Cargo::SetRoom((id, new_room)) => { + if let Some(mark) = self.map.get_room_mut(id) { + mark.set_room(new_room); + } else { + self.map.add_room(id, new_room); + } + } + other => error!("Unknown packet received: {:?}", other), + } + } + } + /// Draw all tools and in case of the active tool also what is currently being edited by it, if /// that exists. pub fn draw_tools(&self, rld: &mut RaylibDrawHandle, transform: &Transform) { |
