ba61dd21a120e8685c247a828f58cc3077192c24
1 static void sfx_internal_debug_overlay(void)
8 u32 length
, cursor
, flags
;
10 infos
[ SFX_MAX_SYSTEMS
];
13 MUTEX_LOCK( sfx_mux_t01
);
15 num_systems
= sfx_sys_len
;
17 for( int i
= 0; i
< sfx_sys_len
; i
++ )
19 sfx_system
*sys
= sfx_sys
+ i
;
20 struct sound_info
*snd
= &infos
[ i
];
22 snd
->signal
= sys
->signal_average
;
23 snd
->name
= sys
->name
;
24 snd
->length
= sys
->end
;
25 snd
->cursor
= sys
->cur
;
26 snd
->flags
= sys
->flags
;
29 MUTEX_UNLOCK( sfx_mux_t01
);
34 ui_begin( &ui_global_ctx
, vg_window_x
, vg_window_y
);
36 // TODO: Find a more elegent form for this
38 if( vg_get_button( "primary" ) ) mouse_state
= 2;
39 if( vg_get_button_down( "primary" ) ) mouse_state
= 1;
40 if( vg_get_button_up( "primary" ) ) mouse_state
= 3;
42 ui_set_mouse( &ui_global_ctx
, vg_mouse
[0], vg_mouse
[1], mouse_state
);
45 for( int i
= 0; i
< num_systems
; i
++ )
47 ui_global_ctx
.cursor
[2] = 150;
48 ui_global_ctx
.cursor
[3] = 12;
50 u32 alpha
= (infos
[i
].flags
& SFX_FLAG_GHOST
)? 0x44000000: 0xff000000;
52 ui_new_node( &ui_global_ctx
);
54 ui_fill_rect( &ui_global_ctx
, ui_global_ctx
.cursor
, 0x00333333 | alpha
);
56 ui_rect_pad( ui_global_ctx
.cursor
, 2 );
57 ui_global_ctx
.cursor
[2] = (int)(((float)infos
[i
].cursor
/ (float)infos
[i
].length
) * 150.0f
);
58 ui_fill_rect( &ui_global_ctx
, ui_global_ctx
.cursor
, 0x77ffffff );
60 ui_text( &ui_global_ctx
, infos
[i
].name
, 1, 0 );
62 ui_end_down( &ui_global_ctx
);
63 ui_global_ctx
.cursor
[1] += 1;
66 ui_resolve( &ui_global_ctx
);
68 m3x3f view
= M3X3_IDENTITY
;
69 m3x3_translate( view
, (v3f
){ -1.0f
, 1.0f
, 0.0f
} );
70 m3x3_scale( view
, (v3f
){ 1.0f
/((float)vg_window_x
*0.5f
), -1.0f
/((float)vg_window_y
*0.5f
), 1.0f
} );
71 vg_lines_drawall( (float*)view
);
73 ui_draw( &ui_global_ctx
);