X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=gui.h;h=3823c152156ed419e51ac68b64581f1a820cb7a0;hb=61d4952a59c72dab12aa5cb9100d4433b2cdcedf;hp=a0de270db36cb7f9dbb0991c7b71fb9d70839a15;hpb=5a233469f45ee7cbdc89cb87956f9ef2989ad1b5;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/gui.h b/gui.h index a0de270..3823c15 100644 --- a/gui.h +++ b/gui.h @@ -140,7 +140,7 @@ static void gui_render_icons(void) 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) ) @@ -151,9 +151,9 @@ static void gui_draw(void) 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; @@ -172,34 +172,34 @@ static void gui_draw(void) 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; @@ -209,24 +209,26 @@ static void gui_draw(void) 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