From: hgn Date: Wed, 5 Jun 2024 20:34:51 +0000 (+0100) Subject: TODO about VSync user message X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=6b3a56ae166e7e69891b24d77de3ba86668ba787;p=vg.git TODO about VSync user message --- diff --git a/vg_engine.c b/vg_engine.c index 105e271..34de465 100644 --- a/vg_engine.c +++ b/vg_engine.c @@ -358,35 +358,47 @@ static void _vg_gameloop_render(void) } } -static void vg_changevsync(void){ - if( vg.vsync && (vg.vsync_feature != k_vsync_feature_error) ){ +static void vg_changevsync(void) +{ + if( vg.vsync && (vg.vsync_feature != k_vsync_feature_error) ) + { /* turn on vsync if not enabled */ enum vsync_feature requested = k_vsync_feature_enabled; if( vg.vsync < 0 ) requested = k_vsync_feature_enabled_adaptive; - if( vg.vsync_feature != requested ){ + if( vg.vsync_feature != requested ) + { vg_info( "Setting swap interval\n" ); int swap_interval = 1; if( requested == k_vsync_feature_enabled_adaptive ) swap_interval = -1; - if( SDL_GL_SetSwapInterval( swap_interval ) == -1 ){ - if( requested == k_vsync_feature_enabled ){ - vg_error( "Vsync is not supported by your system\n" ); - vg_warn( "You may be overriding it in your" - " graphics control panel.\n" ); + if( SDL_GL_SetSwapInterval( swap_interval ) == -1 ) + { + if( requested == k_vsync_feature_enabled ) + { + ui_start_modal( &vg_ui.ctx, + "Vsync not supported on this system.\n\n" + "You may be overriding it in your" + " graphics \ncontrol panel.\n", + UI_MODAL_BAD ); } - else{ - vg_error( "Adaptive Vsync is not supported by your system\n" ); + else + { + ui_start_modal( &vg_ui.ctx, + "Adaptive Vsync is not supported by your system\n\n" + "You may be overriding it in your" + " graphics \ncontrol panel.\n", + UI_MODAL_BAD ); } vg.vsync_feature = k_vsync_feature_error; vg.vsync = 0; - /* TODO: Make popup to notify user that this happened */ } - else{ + else + { vg_success( "Vsync enabled (%d)\n", requested ); vg.vsync_feature = requested; } diff --git a/vg_ui/imgui.c b/vg_ui/imgui.c index 8886652..30ccef2 100644 --- a/vg_ui/imgui.c +++ b/vg_ui/imgui.c @@ -797,7 +797,7 @@ void ui_postrender( ui_context *ctx, f32 delta_time ) ui_rect_center( box, message ); ui_rect row0, row1, btn; - ui_split_ratio( message, k_ui_axis_h, 0.5f, 0, row0, row1 ); + ui_split_ratio( message, k_ui_axis_h, 0.76f, 0, row0, row1 ); row0[0] += ctx->font->sx; ui_ntext( ctx, row0, ctx->modal.message, (box[2]/ctx->font->sx)-2, 1, k_ui_align_left, colour );