From ae694bc0da98e45c5def20ac1d92f9d8aad65fd5 Mon Sep 17 00:00:00 2001 From: Kasullian Date: Wed, 10 Sep 2025 12:08:59 -0400 Subject: 3d view mouse control --- src/editor/view3d.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/editor') diff --git a/src/editor/view3d.cpp b/src/editor/view3d.cpp index f9bd60e..61bcc3e 100644 --- a/src/editor/view3d.cpp +++ b/src/editor/view3d.cpp @@ -31,6 +31,16 @@ void gui_editor_3dview_draw_showpos( GUI_EDITOR_3DVIEW* view ) { objl->pl->rot.y, objl->pl->rot.x ); + + if( input.mouse_captured ) { + gui_draw_str( + x + 2, y + 2, + ALIGN_L, + FNT_JPN12, + ui_clr.txt, + "[capturing mouse]" + ); + } } void gui_editor_3dview_draw_fn( void* ptr ) { @@ -60,9 +70,20 @@ void gui_editor_3dview_draw_fn( void* ptr ) { } void gui_editor_3dview_input_fn( void* ptr ) { + GUI_EDITOR_3DVIEW* view = (GUI_EDITOR_3DVIEW*)ptr; + if( !objl->pl ) return; + if( input.mouse.left && !input.mouse_captured ) { + I32 view_x = gui_relx( view ); + I32 view_y = gui_rely( view ) + EDITORVIEW_TITLE_OFFSET; + if( input.mouse.pos.x >= view_x && input.mouse.pos.x < view_x + view->w && + input.mouse.pos.y >= view_y && input.mouse.pos.y < view_y + view->h ) { + input_capture_mouse( true ); + } + } + game_on_tick( editor->game ); } -- cgit v1.2.3