X-Git-Url: https://harrygodden.com/git/?p=fishladder.git;a=blobdiff_plain;f=vg%2Fvg_debug.h;fp=vg%2Fvg_debug.h;h=0000000000000000000000000000000000000000;hp=1360548d80520b174b06b4474961896ef9e9bd90;hb=30490c4c08d5c0f811017a901aa9e25a95be7c40;hpb=3363633178b1eea582304742ad1202487af0feb1 diff --git a/vg/vg_debug.h b/vg/vg_debug.h deleted file mode 100644 index 1360548..0000000 --- a/vg/vg_debug.h +++ /dev/null @@ -1,97 +0,0 @@ -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 - { - float signal; - const char *name; - u32 cursor, flags; - - u32 buffer_length, clip_start, clip_end; - } - infos[ SFX_MAX_SYSTEMS ]; - int num_systems; - - MUTEX_LOCK( sfx_mux_t01 ); - - num_systems = sfx_sys_len; - - for( int i = 0; i < sfx_sys_len; i ++ ) - { - sfx_system *sys = sfx_sys + i; - struct sound_info *snd = &infos[ i ]; - - //snd->signal = sys->signal_average; - snd->name = sys->name; - snd->cursor = sys->cur; - snd->flags = sys->flags; - snd->clip_start = sys->clip_start; - snd->clip_end = sys->clip_end; - snd->buffer_length = sys->buffer_length; - } - - MUTEX_UNLOCK( sfx_mux_t01 ); - - // UI part - // ======== - - // Draw audio stack - for( int i = 0; i < num_systems; i ++ ) - { - ui_global_ctx.cursor[2] = 150; - ui_global_ctx.cursor[3] = 12; - - u32 alpha = (infos[i].flags & SFX_FLAG_PERSISTENT)? 0xff000000: 0x22000000; - - ui_new_node( &ui_global_ctx ); - { - ui_fill_rect( &ui_global_ctx, ui_global_ctx.cursor, 0x00333333 | alpha ); - - ui_px baseline = ui_global_ctx.cursor[0]; - ui_px width_block_1 = (ui_px)(((float)infos[i].clip_start / (float)infos[i].buffer_length) * 150.0f); - ui_px width_block_2 = (ui_px)(((float)(infos[i].buffer_length-infos[i].clip_end) / (float)infos[i].buffer_length) * 150.0f ); - - ui_global_ctx.cursor[2] = width_block_1; - ui_fill_rect( &ui_global_ctx, ui_global_ctx.cursor, 0x77ffffff ); - - ui_global_ctx.cursor[2] = width_block_2; - ui_align_right( &ui_global_ctx ); - ui_fill_rect( &ui_global_ctx, ui_global_ctx.cursor, 0x77ffffff ); - - // Cursor - - ui_global_ctx.cursor[2] = 2; - ui_global_ctx.cursor[0] = baseline + (ui_px)(((float)infos[i].cursor / (float)infos[i].buffer_length) * 150.0f); - ui_fill_rect( &ui_global_ctx, ui_global_ctx.cursor, 0xffffffff ); - - ui_global_ctx.cursor[0] = baseline + 2; - ui_global_ctx.cursor[1] += 2; - ui_text( &ui_global_ctx, ui_global_ctx.cursor, infos[i].name, 1, 0 ); - } - ui_end_down( &ui_global_ctx ); - ui_global_ctx.cursor[1] += 1; - } -} - -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] ); - } -}