TODO about VSync user message
authorhgn <hgodden00@gmail.com>
Wed, 5 Jun 2024 20:34:51 +0000 (21:34 +0100)
committerhgn <hgodden00@gmail.com>
Wed, 5 Jun 2024 20:34:51 +0000 (21:34 +0100)
vg_engine.c
vg_ui/imgui.c

index 105e271970dcb0030c1a30c4bf0be2b83ef316a0..34de465315be099e9fb1952d17a03c9ac4f07dc8 100644 (file)
@@ -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;
          }
index 88866529643c509e9f7a133e5bbea1d962a9d577..30ccef2f474100112ed7d122e765520948efa06f 100644 (file)
@@ -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 );