X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg%2Fvg_debug.h;h=9c7d87fbb5219f1ec3345204a3e09d207d0a5be6;hb=42fc2b14afbe5a37bdd469b9bac5f642bc50ccc4;hp=333aed82ddc819b694a28315312e183962912903;hpb=f8e80fde4a84a6b990ec17c067b2a95847ae744c;p=fishladder.git diff --git a/vg/vg_debug.h b/vg/vg_debug.h index 333aed8..9c7d87f 100644 --- a/vg/vg_debug.h +++ b/vg/vg_debug.h @@ -1,5 +1,15 @@ +int debug_sfx = 0; + +struct vg_convar debug_cvars[] = +{ + { .name = "debug_sfx", .data = &debug_sfx, .data_type = k_convar_dtype_i32 } +}; + static void sfx_internal_debug_overlay(void) { + if( !debug_sfx ) + return; + // Grab values struct sound_info { @@ -44,16 +54,6 @@ static void sfx_internal_debug_overlay(void) // UI part // ======== - - ui_begin( &ui_global_ctx, vg_window_x, vg_window_y ); - - // TODO: Find a more elegent form for this - int mouse_state = 0; - if( vg_get_button( "primary" ) ) mouse_state = 2; - if( vg_get_button_down( "primary" ) ) mouse_state = 1; - if( vg_get_button_up( "primary" ) ) mouse_state = 3; - - ui_set_mouse( &ui_global_ctx, vg_mouse[0], vg_mouse[1], mouse_state ); // Draw audio stack for( int i = 0; i < num_systems; i ++ ) @@ -91,13 +91,17 @@ static void sfx_internal_debug_overlay(void) ui_end_down( &ui_global_ctx ); ui_global_ctx.cursor[1] += 1; } - - ui_resolve( &ui_global_ctx ); - - m3x3f view = M3X3_IDENTITY; - m3x3_translate( view, (v3f){ -1.0f, 1.0f, 0.0f } ); - m3x3_scale( view, (v3f){ 1.0f/((float)vg_window_x*0.5f), -1.0f/((float)vg_window_y*0.5f), 1.0f } ); - vg_lines_drawall( (float*)view ); - - ui_draw( &ui_global_ctx ); +} + +static void vg_debugtools_draw(void) +{ + sfx_internal_debug_overlay(); +} + +static void vg_debugtools_setup(void) +{ + for( int i = 0; i < vg_list_size( debug_cvars ); i ++ ) + { + vg_convar_push( debug_cvars[i] ); + } }