X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg.h;h=132f338275933833d2a0545e6c1dfd3cb5376b9f;hb=c14db510e727e91cd0041f73663ef5b7ca32e05f;hp=e632efae139614bd9ffb0ca95e619ba3983574a1;hpb=f6ea7c881fe9fdd885f57e0b3d7daa9829f48d47;p=vg.git diff --git a/vg.h b/vg.h index e632efa..132f338 100644 --- a/vg.h +++ b/vg.h @@ -26,17 +26,17 @@ |IMP| | |.------------- vg_start(void) ---------------' | | | | | | | v -|IMP| | vg_update(void) +|IMP| | vg_pre_update(void) | | | | | | | .-----+. -| | | | | +| | | | | called 0x to 8x | | | | v -|IMP| | '- vg_update_fixed(void) +|IMP| | '- vg_fixed_update(void) | | | | | | | .-' | | | | | | | v -|IMP| | vg_update_post(void) +|IMP| | vg_post_update(void) | | | | | | | v |IMP| | vg_render(void) @@ -56,35 +56,6 @@ #include "vg_platform.h" #include "vg_mem.h" - - #ifndef _WIN32 - #include - #endif - -VG_STATIC void vg_print_backtrace(void) -{ -#ifndef _WIN32 - - void *array[20]; - char **strings; - int size, i; - - size = backtrace( array, 20 ); - strings = backtrace_symbols( array, size ); - - if( strings != NULL ){ - vg_error( "---------------- gnu backtrace -------------\n" ); - - for( int i=0; i= VG_TIMESTEP_FIXED ){ - vg_update_fixed(); + vg_fixed_update(); vg_lines.allow_input = 0; - vg.time_fixed_accumulator -= VG_TIMESTEP_FIXED; - //vg.accumulator = VG_MAX( 0.0, vg.accumulator ); vg.fixed_iterations ++; if( vg.fixed_iterations == 8 ){ @@ -436,7 +414,7 @@ VG_STATIC void _vg_gameloop_update(void) vg.time_fixed_extrapolate = vg.time_fixed_accumulator / VG_TIMESTEP_FIXED; vg.engine_stage = k_engine_stage_update; - vg_update_post(); + vg_post_update(); vg_profile_end( &vg_prof_update ); } @@ -588,8 +566,7 @@ VG_STATIC int _vg_crashscreen(void) return 0; } -VG_STATIC void _vg_gameloop(void) -{ +VG_STATIC void _vg_gameloop(void){ //vg.time_fixed_accumulator = 0.75f * (1.0f/60.0f); vg.time_hp = SDL_GetPerformanceCounter(); @@ -639,8 +616,8 @@ VG_STATIC void _vg_gameloop(void) } if( vg.loader_ring > 0.01f ){ - vg.loader_ring -= vg.time_frame_delta * 0.5f; _vg_loader_render_ring( vg.loader_ring ); + vg.loader_ring -= vg.time_frame_delta * 0.5f; } vg.time_frame_delta = 0.0; @@ -720,11 +697,6 @@ VG_STATIC void _vg_init_window( const char *window_name ) display_index = 0, mode_index = 0; -#ifdef VG_DEVWINDOW - vg.window_x = 1600; - vg.window_y = 1000; -#else - SDL_DisplayMode video_mode; if( SDL_GetDesktopDisplayMode( display_index, &video_mode ) ){ vg_error( "SDL_GetDesktopDisplayMode failed: %s\n", SDL_GetError() ); @@ -735,6 +707,10 @@ VG_STATIC void _vg_init_window( const char *window_name ) vg.display_refresh_rate = video_mode.refresh_rate; vg.window_x = video_mode.w; vg.window_y = video_mode.h; + +#ifdef VG_DEVWINDOW + vg.window_x = 1200; + vg.window_y = 880; #endif #ifndef _WIN32 @@ -752,7 +728,9 @@ VG_STATIC void _vg_init_window( const char *window_name ) #ifdef VG_DEVWINDOW 0, 0, vg.window_x, vg.window_y, SDL_WINDOW_BORDERLESS|SDL_WINDOW_OPENGL|SDL_WINDOW_INPUT_GRABBED - ))){} + ))){ + SDL_SetWindowPosition( vg.window, video_mode.w-vg.window_x, 0 ); + } #else 0, 0, vg.window_x, vg.window_y, @@ -877,7 +855,7 @@ VG_STATIC void vg_fatal_error( const char *fmt, ... ) { va_list args; va_start( args, fmt ); - _vg_log_write( stderr, KRED " fatal" KWHT "| " KRED, fmt, args ); + _vg_logx_va( stderr, NULL, "fatal", KRED, fmt, args ); va_end( args ); vg_print_backtrace(); @@ -902,7 +880,7 @@ VG_STATIC void vg_fatal_error( const char *fmt, ... ) { va_list args; va_start( args, fmt ); - _vg_log_write( stderr, KRED " fatal" KWHT "| " KRED, fmt, args ); + _vg_logx_va( stderr, NULL, "fatal", KRED, fmt, args ); va_end( args ); exit(0); } @@ -915,4 +893,6 @@ VG_STATIC void vg_fatal_error( const char *fmt, ... ) u32 NvOptimusEnablement = 0x00000001; int AmdPowerXpressRequestHighPerformance = 1; +#include "vg_log.c" + #endif /* VG_HEADER_H */