From 625d00bb0e9a374e7ecf4b91fde599307199f3b6 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Fri, 6 Nov 2020 00:53:46 +0100 Subject: Add icon tool --- src/editor.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/editor.rs') 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> = 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 { -- cgit v1.2.3-70-g09d2