X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=main.c;h=2ac5e20bdddbe140c3d20e114baa4823bd4d7dbe;hb=70792eeb23451cef1f3a103e0c9515b833f81899;hp=0d4ee25781014e1026cd45c90721130aab2cbafb;hpb=a98ce96041b248580c0447bf87d4c6106483cade;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/main.c b/main.c index 0d4ee25..2ac5e20 100644 --- a/main.c +++ b/main.c @@ -26,11 +26,13 @@ #include "audio.h" #include "world.h" #include "player.h" +#include "network.h" -static int cl_ui = 1; +static int cl_ui = 1, + cl_menu = 0; int main( int argc, char *argv[] ) -{ +{ vg_enter( argc, argv, "Voyager Game Engine" ); } @@ -59,6 +61,9 @@ vg_info(" ' ' '--' [] '----- '----- ' ' '---' " "SOFTWARE\n" ); highscores_init( 2000, 50 ); + if( !highscores_read() ) + highscores_create_db(); + vg_loader_highwater( NULL, highscores_save_at_exit, NULL ); vg_sleep_ms(200); @@ -109,6 +114,11 @@ void vg_update( int loaded ) player_update_pre(); world_update( player.phys.rb.co ); } + + if( vg_get_button_down( "menu" ) ) + { + cl_menu = !cl_menu; + } } static void vg_update_fixed( int loaded ) @@ -139,7 +149,11 @@ static void render_main_game(void) m4x4f world_4x4; m4x3_expand( player.camera_inverse, world_4x4 ); - gpipeline.fov = freecam? 60.0f: 125.0f; /* 120 */ + static float fov = 97.0f; + float fov_target = player.phys.on_board? 125.0f: 108.0f; + fov = vg_lerpf( fov, fov_target, vg.time_delta * 2.0f ); + + gpipeline.fov = freecam? 60.0f: fov; /* 120 */ m4x4_projection( vg.pv, gpipeline.fov, (float)vg.window_x / (float)vg.window_y, 0.02f, 2100.0f ); @@ -228,6 +242,39 @@ void vg_render(void) void vg_ui(void) { + if( cl_menu ) + { + ui_rect menu = + { + vg.window_x / 2 - 150, + vg.window_y / 2 - 50, + 300, + 130 + }; + + ui_fill_rect( &ui_global_ctx, menu, 0xa0000000 ); + + ui_text( &ui_global_ctx, (ui_rect){ menu[0]+menu[2]/2,menu[1]+6, 0, 0 }, + steam_username_at_startup, + 1, k_text_align_center ); + menu[1] += 24; + menu[3] -= 30; + + ui_rect_pad( menu, 8 ); + ui_fill_rect( &ui_global_ctx, menu, 0x90ffffff ); + ui_rect_pad( menu, 2 ); + ui_fill_rect( &ui_global_ctx, menu, 0xa0000000 ); + + menu[1] += 32; + ui_text( &ui_global_ctx, (ui_rect){ menu[0]+menu[2]/2,menu[1], 0, 0 }, + "Exit", 2, k_text_align_center ); + + if( vg_get_button_down( "jump" ) ) + { + glfwSetWindowShouldClose( vg.window, 1 ); + } + } + #if 0 if( lightedit ) {