summaryrefslogtreecommitdiff
path: root/src/editor/view2d.cpp
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-08-11 19:10:04 +0200
committeraura <nw@moneybot.cc>2026-08-11 19:10:04 +0200
commit1aa17de9188790f049c0edc4281597cb4e535627 (patch)
tree23b1ab21179165bfca625da2e6f1e90803107ef9 /src/editor/view2d.cpp
parente540910745aad31378452eec25aacfb3f346191a (diff)
wip on shape tool
Diffstat (limited to 'src/editor/view2d.cpp')
-rw-r--r--src/editor/view2d.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/editor/view2d.cpp b/src/editor/view2d.cpp
index fe82c08..7a7ea3e 100644
--- a/src/editor/view2d.cpp
+++ b/src/editor/view2d.cpp
@@ -1334,8 +1334,7 @@ void gui_editor_2dview_input_scroll( GUI_EDITOR_2DVIEW* view ) {
view->dragheld = 0;
}
-void gui_editor_2dview_input_tool_wall( GUI_EDITOR_2DVIEW* view ) {
- if( editor->tool.wallshape == EDITOR_WALLSHAPE_POLYGON ) {
+void gui_editor_2dview_input_tool_wall_shape( GUI_EDITOR_2DVIEW* view ) {
U8 m1 = gui_mbutton_down( 0 );
I32 mx, my;
gui_cursor_pos( &mx, &my );
@@ -1360,8 +1359,10 @@ void gui_editor_2dview_input_tool_wall( GUI_EDITOR_2DVIEW* view ) {
view->poly_end = world;
return;
- }
+}
+
+void gui_editor_2dview_input_tool_wall_line( GUI_EDITOR_2DVIEW* view ) {
U8 m1 = gui_mbutton_down( 0 );
if( !m1 ) {
if( view->held ) {
@@ -1413,7 +1414,14 @@ void gui_editor_2dview_input_tool_wall( GUI_EDITOR_2DVIEW* view ) {
}
}
-void gui_editor_2dview_input_tool_poly( GUI_EDITOR_2DVIEW* view ) {
+void gui_editor_2dview_input_tool_wall( GUI_EDITOR_2DVIEW* view ) {
+ switch( editor->tool.wallshape ) {
+ case EDITOR_WALLSHAPE_POLYGON: return gui_editor_2dview_input_tool_wall_shape( view );
+ default: return gui_editor_2dview_input_tool_wall_line( view );
+ }
+}
+
+void gui_editor_2dview_input_tool_poly_drag( GUI_EDITOR_2DVIEW* view ) {
U8 m1 = gui_mbutton_down( 0 );
I32 mx, my;
gui_cursor_pos( &mx, &my );
@@ -1439,6 +1447,12 @@ void gui_editor_2dview_input_tool_poly( GUI_EDITOR_2DVIEW* view ) {
view->poly_end = world;
}
+void gui_editor_2dview_input_tool_poly( GUI_EDITOR_2DVIEW* view ) {
+ switch( editor->tool.polyshape ) {
+ default: return gui_editor_2dview_input_tool_poly_drag( view );
+ }
+}
+
void gui_editor_2dview_input_tool_object( GUI_EDITOR_2DVIEW* view ) {
U8 m1 = gui_mbutton_down( 0 );
if( !m1 ) {
@@ -1504,8 +1518,8 @@ void gui_editor_2dview_input_tool_draw( GUI_EDITOR_2DVIEW* view ) {
}
switch( editor->tool.type ) {
- case EDITOR_TOOL_WALL: return gui_editor_2dview_input_tool_wall( view );
- case EDITOR_TOOL_POLY: return gui_editor_2dview_input_tool_poly( view );
+ case EDITOR_TOOL_WALL: return gui_editor_2dview_input_tool_wall( view );
+ case EDITOR_TOOL_POLY: return gui_editor_2dview_input_tool_poly( view );
case EDITOR_TOOL_OBJECT: return gui_editor_2dview_input_tool_object( view );
default: return;
}