diff options
Diffstat (limited to 'src/editor.rs')
| -rw-r--r-- | src/editor.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/editor.rs b/src/editor.rs index a68bb25..01bd268 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -3,7 +3,7 @@ use crate::tool::*; use crate::transform::Transform; use raylib::core::drawing::RaylibDrawHandle; use raylib::ffi::KeyboardKey; -use raylib::RaylibHandle; +use raylib::{RaylibHandle, RaylibThread}; pub struct Editor { map_data: MapData, @@ -12,13 +12,15 @@ pub struct Editor { } impl Editor { - pub fn new() -> Self { + pub fn new(rl: &mut RaylibHandle, rlt: &RaylibThread) -> Self { let mut tools: Vec<Box<dyn Tool>> = Vec::with_capacity(ToolType::NumTools as usize); assert_eq!(ToolType::RoomTool as u8, 0); tools.push(Box::new(RoomTool::new())); assert_eq!(ToolType::WallTool as u8, 1); tools.push(Box::new(WallTool::new())); - assert_eq!(ToolType::DeletionTool as u8, 2); + assert_eq!(ToolType::IconTool as u8, 2); + tools.push(Box::new(IconTool::new(rl, rlt))); + assert_eq!(ToolType::DeletionTool as u8, 3); tools.push(Box::new(DeletionTool::new())); assert_eq!(ToolType::NumTools as usize, tools.len()); @@ -36,6 +38,8 @@ impl Editor { ToolType::RoomTool as usize } else if rl.is_key_pressed(KeyboardKey::KEY_W) { ToolType::WallTool as usize + } else if rl.is_key_pressed(KeyboardKey::KEY_I) { + ToolType::IconTool as usize } else if rl.is_key_pressed(KeyboardKey::KEY_D) { ToolType::DeletionTool as usize } else { |
