fix achievement bug
[carveJwlIkooP6JGAAIwe30JlM.git] / gui.h
diff --git a/gui.h b/gui.h
index 30664d8a00bb7b8905e92dc0fd10a04bf0af33cf..c6ebe715b0441ac3a94245f69124d92b80f0a854 100644 (file)
--- a/gui.h
+++ b/gui.h
@@ -1,18 +1,23 @@
-#ifndef GUI_H
-#define GUI_H
-
+#pragma once
 #include "font.h"
 #include "input.h"
 #include "player.h"
 
 enum gui_icon {
    k_gui_icon_tick    = 0,
+   k_gui_icon_tick_2d,
    k_gui_icon_exclaim,
+   k_gui_icon_exclaim_2d,
    k_gui_icon_board,
    k_gui_icon_world,
    k_gui_icon_rift,
    k_gui_icon_rift_run,
+   k_gui_icon_rift_run_2d,
    k_gui_icon_friend,
+   k_gui_icon_player,
+   k_gui_icon_rift_run_gold,
+   k_gui_icon_rift_run_silver,
+   k_gui_icon_glider,
 
    k_gui_icon_count,
 };
@@ -80,7 +85,7 @@ static void gui_draw(void){
          (v3_dist2(localplayer.rb.co,gui.trick_co) > 2.0f) )
       gui_helper_clear();
 
-   camera ortho;
+   vg_camera ortho;
 
    float fl = 0.0f,
          fr = vg.window_x,
@@ -96,9 +101,9 @@ static void gui_draw(void){
    ortho.mtx.p[3][1] = (ft + fb) * -tb;
    ortho.mtx.p[3][3] = 1.0f;
    m4x3_identity( ortho.transform );
-   camera_update_view( &ortho );
+   vg_camera_update_view( &ortho );
    m4x4_mul( ortho.mtx.p, ortho.mtx.v, ortho.mtx.pv );   /* HACK */
-   camera_finalize( &ortho );
+   vg_camera_finalize( &ortho );
 
 
    /* icons */
@@ -188,7 +193,6 @@ static void gui_draw(void){
    v3_zero( mmdl[3] );
 
    float pad = dy*0x1p-4f*0.125f;
-   mmdl[3][0] = pad*2.0f;
    mmdl[3][1] = pad;
 
    for( u32 i=0; i<gui.helper_count; i++ ){
@@ -199,6 +203,10 @@ static void gui_draw(void){
       vg_strnull( &str, buf, sizeof(buf) );
       vg_input_string( &str, helper->binding, 1 );
 
+      f32 bs = (f32)vg.window_x / (f32)(gui.helper_count+1),
+          x  = ((f32)i + 1.0f) * bs;
+      mmdl[3][0] = x - font3d_string_width( 2, buf )*0.5f*scale;
+
       font3d_setcolour( (v4f){1.0f,1.0f,1.0f, helper->greyed? 0.5f: 1.0f} );
       font3d_simple_draw( 2, buf, &ortho, mmdl );
 
@@ -207,7 +215,6 @@ static void gui_draw(void){
       font3d_draw( helper->text );
       
       float w = gui_font3d.offset[0]+1.0f;
-      mmdl[3][0] += w*scale;
    }
 }
 
@@ -311,12 +318,21 @@ static void gui_init(void){
    mdl_load_metadata_block( &gui.model_icons, alloc );
 
    gui.icons[ k_gui_icon_tick ] = gui_find_icon( "icon_tick" );
+   gui.icons[ k_gui_icon_tick_2d ] = gui_find_icon( "icon_tick2d" );
    gui.icons[ k_gui_icon_exclaim ] = gui_find_icon( "icon_exclaim" );
+   gui.icons[ k_gui_icon_exclaim_2d ] = gui_find_icon( "icon_exclaim2d" );
    gui.icons[ k_gui_icon_board ] = gui_find_icon( "icon_board" );
    gui.icons[ k_gui_icon_world ] = gui_find_icon( "icon_world" );
    gui.icons[ k_gui_icon_rift ] = gui_find_icon( "icon_rift" );
    gui.icons[ k_gui_icon_rift_run ] = gui_find_icon( "icon_rift_run" );
+   gui.icons[ k_gui_icon_rift_run_2d ] = gui_find_icon( "icon_rift_run2d" );
    gui.icons[ k_gui_icon_friend ] = gui_find_icon( "icon_friend" );
+   gui.icons[ k_gui_icon_player ] = gui_find_icon( "icon_player" );
+   gui.icons[ k_gui_icon_glider ] = gui_find_icon( "icon_glider" );
+   gui.icons[ k_gui_icon_rift_run_gold ] =
+      gui_find_icon("icon_rift_run_medal_gold");
+   gui.icons[ k_gui_icon_rift_run_silver]=
+      gui_find_icon("icon_rift_run_medal_silver");
 
    vg_linear_clear( vg_mem.scratch );
    if( !mdl_arrcount( &gui.model_icons.textures ) )
@@ -328,8 +344,6 @@ static void gui_init(void){
                             VG_TEX2D_LINEAR|VG_TEX2D_CLAMP,
                             &gui.icons_texture );
 
-   mdl_async_load_glmesh( &gui.model_icons, &gui.icons_mesh );
+   mdl_async_load_glmesh( &gui.model_icons, &gui.icons_mesh, NULL );
    mdl_close( &gui.model_icons );
 }
-
-#endif /* GUI_H */