gui.icon_draw_count = 0;
}
-static void gui_draw(void)
+static void gui_draw( ui_context *ctx )
{
if( gui.active_positional_helper &&
(v3_dist2(localplayer.rb.co,gui.trick_co) > 2.0f) )
gui.factive = vg_lerpf( gui.factive, gui.helper_count?1.0f:0.0f,
vg.time_frame_delta*2.0f );
-
- ui_font_face( &vgf_default_title );
- ui_px height = ui_current_font()->ch + 16;
+
+ ctx->font = &vgf_default_title;
+ ui_px height = ctx->font->ch + 16;
ui_rect lwr = { 0, vg.window_y - height, vg.window_x, height };
ui_px x = 0;
f32 opacity = 0.4f;
if( helper->greyed )
{
- fg = ui_colour(k_ui_fg+2);
+ fg = ui_colour(ctx, k_ui_fg+2);
opacity = 0.1f;
}
- struct ui_vert *bg = ui_fill( box, ui_opacity( GUI_COL_DARK, opacity ) );
+ struct ui_vert *bg = ui_fill( ctx, box,
+ ui_opacity( GUI_COL_DARK, opacity ) );
u32 w;
box[0] += 16;
- w = ui_text( box, buf, 1, k_ui_align_middle_left, fg );
- w *= ui_current_font()->sx;
+ w = ui_text( ctx, box, buf, 1, k_ui_align_middle_left, fg );
+ w *= ctx->font->sx;
bg[1].co[0] = x + w + 32;
bg[2].co[0] = x + w + 32;
x += w + 32;
box[0] = x;
- bg = ui_fill( box, ui_opacity( GUI_COL_NORM, opacity*0.7f ) );
+ bg = ui_fill( ctx, box, ui_opacity( GUI_COL_NORM, opacity*0.7f ) );
box[0] += 8;
- w = ui_text( box, helper->text, 1, k_ui_align_middle_left, fg );
- w *= ui_current_font()->sx;
+ w = ui_text( ctx, box, helper->text, 1, k_ui_align_middle_left, fg );
+ w *= ctx->font->sx;
bg[1].co[0] = box[0] + w + 16;
bg[2].co[0] = box[0] + w + 16;
x += w + 32;
}
- ui_context *ctx = ui_current_context();
- ctx->frosting = gui.factive*0.015f;
- ui_flush( k_ui_shader_colour );
- ctx->frosting = 0.0f;
+ vg_ui.frosting = gui.factive*0.015f;
+ ui_flush( ctx, k_ui_shader_colour, NULL );
+ vg_ui.frosting = 0.0f;
f64 loc_t = (vg.time_real - gui.location_time) / 5.0;
o = 1.0f-t*t*(2.0f-t);
ui_rect box = { 0, (vg.window_y*2)/3 - height/2, vg.window_x, height };
- ui_fill( box, ui_opacity( GUI_COL_NORM, 0.5f ) );
- ui_text( box, gui.location, 1, k_ui_align_middle_center, 0 );
+ ui_fill( ctx, box, ui_opacity( GUI_COL_NORM, 0.5f ) );
+ ui_text( ctx, box, gui.location, 1, k_ui_align_middle_center, 0 );
- ctx->colour[3] = o;
- ui_flush( k_ui_shader_colour );
+ vg_ui.colour[3] = o;
+ ui_flush( ctx, k_ui_shader_colour, NULL );
}
- ctx->colour[3] = 1.0f;
- ui_font_face( &vgf_default_small );
+ vg_ui.colour[3] = 1.0f;
+ ctx->font = &vgf_default_small;
}
static int gui_location_print_ccmd( int argc, const char *argv[] )
{
- if( argc > 0 ){
+ if( argc > 0 )
+ {
char new_loc[64];
vg_str str;
vg_strnull( &str, new_loc, 64 );
- for( int i=0; i<argc; i++ ){
+ for( int i=0; i<argc; i++ )
+ {
vg_strcat( &str, argv[i] );
vg_strcat( &str, " " );
}
return 0;
}
-static int gui_showtrick_ccmd( int argc, const char *argv[] ){
- if( argc == 1 ){
+static int gui_showtrick_ccmd( int argc, const char *argv[] )
+{
+ if( argc == 1 )
+ {
gui_helper_clear();
vg_str text;
return 1;
}
-static void gui_draw_icon( enum gui_icon icon, v2f co, f32 size ){
+static void gui_draw_icon( enum gui_icon icon, v2f co, f32 size )
+{
if( gui.icon_draw_count == vg_list_size(gui.icon_draw_buffer) )
return;
return NULL;
}
-static void gui_init(void){
+static void gui_init(void)
+{
font3d_load( &gui.font, "models/rs_font.mdl", vg_mem.rtmemory );
vg_console_reg_cmd( "gui_location", gui_location_print_ccmd, NULL );
vg_console_reg_cmd( "showtrick", gui_showtrick_ccmd, NULL );