From: hgn Date: Thu, 18 Apr 2024 12:07:04 +0000 (+0100) Subject: move mouse wakeup from SR to VG X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=commitdiff_plain;h=809e802a62579292a64af48937476f4670b2a374 move mouse wakeup from SR to VG --- diff --git a/vg_engine.c b/vg_engine.c index 1723c70..fe3a7e9 100644 --- a/vg_engine.c +++ b/vg_engine.c @@ -141,9 +141,6 @@ static void _vg_process_events(void) v2_zero( vg.mouse_wheel ); v2_zero( vg.mouse_delta ); - /* Update input */ - vg_process_inputs(); - /* SDL event loop */ SDL_Event event; while( SDL_PollEvent( &event ) ){ @@ -221,6 +218,7 @@ static void _vg_process_events(void) } SDL_GetMouseState( &vg.mouse_pos[0], &vg.mouse_pos[1] ); + vg_process_inputs(); } static void _vg_gameloop_update(void) diff --git a/vg_input.c b/vg_input.c index 74732f4..c536c1f 100644 --- a/vg_input.c +++ b/vg_input.c @@ -210,10 +210,13 @@ void vg_process_inputs(void) vg_input.sdl_keys = SDL_GetKeyboardState( &count ); vg_input.sdl_mouse = SDL_GetMouseState(NULL,NULL); - if( vg_input.display_input_method != k_input_method_kbm ){ + if( vg_input.display_input_method != k_input_method_kbm ) + { /* check for giving keyboard priority */ - for( int i=0; i 64.0f ) + { + vg_input.display_input_method = k_input_method_kbm; + vg_input.hidden_mouse_travel = 0.0f; + vg_info( "display_input: k_input_method_kbm (mouse move)\n" ); } } + else + vg_input.hidden_mouse_travel = 0.0f; } void async_vg_input_init( void *payload, u32 size ) diff --git a/vg_input.h b/vg_input.h index a203123..1636e07 100644 --- a/vg_input.h +++ b/vg_input.h @@ -47,6 +47,7 @@ struct vg_input { const u8 *sdl_keys; u32 sdl_mouse; + f32 hidden_mouse_travel; struct vg_controller{ SDL_GameController *handle; /* handle for controller. NULL if unused */