aboutsummaryrefslogtreecommitdiff
path: root/src/tool/mod.rs
blob: f503d2b61c6dfa67512b3531888c518dbff6a4ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
pub mod deletion_tool;
pub mod icon_tool;
pub mod polygon_room_tool;
pub mod room_tool;
pub mod wall_tool;

pub use deletion_tool::DeletionTool;
pub use icon_tool::IconTool;
pub use polygon_room_tool::PolygonRoomTool;
pub use room_tool::RoomTool;
pub use wall_tool::WallTool;

use crate::button::Button;
use crate::map_data::MapData;
use crate::transform::Transform;
use raylib::core::drawing::RaylibDrawHandle;
use raylib::RaylibHandle;

#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(u8)]
pub enum ToolType {
    RoomTool,
    PolygonRoomTool,
    WallTool,
    IconTool,
    DeletionTool,
    NumTools,
}

pub trait Tool {
    fn activate(&mut self) {}
    fn deactivate(&mut self) {}

    fn update(&mut self, _map: &MapData, _rl: &RaylibHandle, _transform: &Transform) {}
    fn active_update(
        &mut self,
        map: &mut MapData,
        rl: &RaylibHandle,
        transform: &Transform,
        mouse_blocked: bool,
    );

    fn draw(&self, _map: &MapData, _rld: &mut RaylibDrawHandle, _transform: &Transform) {}

    fn activation_key(&self) -> Button;
}