diff options
| author | Kasullian <tomkasull@gmail.com> | 2025-09-10 12:08:59 -0400 |
|---|---|---|
| committer | Kasullian <tomkasull@gmail.com> | 2025-09-10 12:08:59 -0400 |
| commit | ae694bc0da98e45c5def20ac1d92f9d8aad65fd5 (patch) | |
| tree | fec648ec2ee3c7ab44ad555c837653ade8e7ac34 /src/editor/view3d.cpp | |
| parent | e2366afb57d69f3952bbb4d1894d82293cd1cb9d (diff) | |
3d view mouse control
Diffstat (limited to 'src/editor/view3d.cpp')
| -rw-r--r-- | src/editor/view3d.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
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 ); } |
