X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=gui.h;h=a0de270db36cb7f9dbb0991c7b71fb9d70839a15;hb=refs%2Fheads%2Fmenu2;hp=c1ce8d71a41ea81120b6c0767e56664c41a10441;hpb=fd9119a30ccb8def877a4187348dd071b08227c0;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/gui.h b/gui.h index c1ce8d7..3823c15 100644 --- a/gui.h +++ b/gui.h @@ -2,7 +2,8 @@ #include "font.h" #include "input.h" #include "player.h" -#include "vg/vg_imgui.h" +#include "vg/vg_engine.h" +#include "vg/vg_ui/imgui.h" #define GUI_COL_DARK ui_opacity( 0x00000000, 0.7f ) #define GUI_COL_NORM ui_opacity( 0x00101010, 0.7f ) @@ -139,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) ) @@ -150,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 = vg_ui.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; @@ -171,32 +172,33 @@ 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 *= vg_ui.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 *= vg_ui.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; } - vg_ui.frosting = gui.factive*0.015f; - ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y ); + vg_ui.frosting = gui.factive*0.015f; + ui_flush( ctx, k_ui_shader_colour, NULL ); vg_ui.frosting = 0.0f; @@ -207,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 ); vg_ui.colour[3] = o; - ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y ); + ui_flush( ctx, k_ui_shader_colour, NULL ); } vg_ui.colour[3] = 1.0f; - ui_font_face( &vgf_default_small ); + 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