1pub use crate::prelude::*;
2use rusterix::Assets;
3
4pub mod game;
8pub mod linedef;
10pub mod rect;
11pub mod sector;
13pub mod selection;
14pub mod entity;
17pub mod vertex;
18
19pub enum PanelIndices {
20 TilePicker,
21 ShadeGridFx,
22}
23
24#[derive(PartialEq, Clone, Debug, Copy)]
25pub enum ToolEvent {
26 Activate,
27 DeActivate,
28
29 TileDown(Vec2<i32>, Vec2<f32>),
30 TileDrag(Vec2<i32>, Vec2<f32>),
31 TileUp,
32}
33
34#[derive(PartialEq, Clone, Debug, Copy)]
35pub enum MapEvent {
36 MapClicked(Vec2<i32>),
37 MapDragged(Vec2<i32>),
38 MapHover(Vec2<i32>),
39 MapUp(Vec2<i32>),
40 MapDelete,
41 MapEscape,
42 MapKey(char),
43}
44
45#[allow(unused)]
46pub trait Tool: Send + Sync {
47 fn new() -> Self
48 where
49 Self: Sized;
50
51 fn id(&self) -> TheId;
52 fn info(&self) -> String;
53 fn icon_name(&self) -> String;
54
55 fn accel(&self) -> Option<char> {
56 None
57 }
58
59 fn help_url(&self) -> Option<String> {
60 None
61 }
62
63 #[allow(clippy::too_many_arguments)]
64 fn tool_event(
65 &mut self,
66 tool_event: ToolEvent,
67 ui: &mut TheUI,
68 ctx: &mut TheContext,
69 project: &mut Project,
70 server_ctx: &mut ServerContext,
71 ) -> bool {
72 false
73 }
74
75 fn map_event(
76 &mut self,
77 map_event: MapEvent,
78 ui: &mut TheUI,
79 ctx: &mut TheContext,
80 map: &mut Map,
81 server_ctx: &mut ServerContext,
82 ) -> Option<ProjectUndoAtom> {
83 None
84 }
85
86 fn handle_event(
87 &mut self,
88 event: &TheEvent,
89 ui: &mut TheUI,
90 ctx: &mut TheContext,
91 project: &mut Project,
92 server_ctx: &mut ServerContext,
93 ) -> bool {
94 false
95 }
96
97 fn draw_hud(
98 &mut self,
99 buffer: &mut TheRGBABuffer,
100 map: &mut Map,
101 ctx: &mut TheContext,
102 server_ctx: &mut ServerContext,
103 assets: &Assets,
104 ) {
105 }
106}