X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=gui.h;h=a0de270db36cb7f9dbb0991c7b71fb9d70839a15;hb=refs%2Fheads%2Fmenu2;hp=c60c51be00b975e6f001509b3bb01b8faf4f6f9f;hpb=494c85703c76c4123c49937a32584840b6be1470;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/gui.h b/gui.h index c60c51b..3823c15 100644 --- a/gui.h +++ b/gui.h @@ -2,7 +2,14 @@ #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 ) +#define GUI_COL_ACTIVE ui_opacity( 0x00444444, 0.7f ) +#define GUI_COL_CLICK ui_opacity( 0x00858585, 0.7f ) +#define GUI_COL_HI ui_opacity( 0x00ffffff, 0.8f ) enum gui_icon { k_gui_icon_tick = 0, @@ -19,6 +26,8 @@ enum gui_icon { k_gui_icon_rift_run_gold, k_gui_icon_rift_run_silver, k_gui_icon_glider, + k_gui_icon_spawn, + k_gui_icon_spawn_select, k_gui_icon_count, }; @@ -42,7 +51,7 @@ struct{ v4f colour; int colour_changed; } - icon_draw_buffer[32]; + icon_draw_buffer[64]; u32 icon_draw_count; v4f cur_icon_colour; int colour_changed; @@ -131,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) ) @@ -142,16 +151,11 @@ 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 }; - if( gui.factive > 0.01f ) - { - //ui_fill( lwr, ui_opacity( 0xff000000, gui.factive*0.8f ) ); - } - ui_px x = 0; for( u32 i=0; igreyed ) { - 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( 0x00000000, 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( 0x00101010, 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; @@ -204,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( 0x00101010, 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