patch up things from text changes
[fishladder.git] / vg / vg_ui.h
index d4fb20bab148ddb058bbef6a1aa756d6255dfb3f..b8f826c297dc1a07ac51cd216f118707c3eac1a2 100644 (file)
@@ -148,9 +148,8 @@ struct ui_ctx
 // ===========================================================================================================
 
 // Opengl
-int ui_glyph_override = 0;
-ui_px ui_glyph_spacing_x = 9;
-GLuint ui_glyph_texture = 0;
+static ui_px ui_glyph_spacing_x = 9;
+static GLuint ui_glyph_texture = 0;
 
 ui_colourset ui_default_colours = {
        .main = 0xff00ff00,
@@ -224,53 +223,40 @@ static void ui_context_free( ui_ctx *ctx )
        free( ctx->indices );
 }
 
-static void ui_override_font( GLuint new_tex, ui_px space_x )
-{
-       if( ui_glyph_texture )
-               glDeleteTextures( 1, &ui_glyph_texture );
-       
-       ui_glyph_texture = new_tex;
-       ui_glyph_override = 1;
-       ui_glyph_spacing_x = space_x;
-}
-
 static void ui_default_init(void)
 {
        // Load default font
-       if( !ui_glyph_override )
-       {
-               u32 compressed[] = {
-                       #include "vg/vg_pxfont.h"
-               };
-       
-               u32 pixels = 0, total = 256*256, data = 0;
-               u8 *image = malloc( total );
-               
-               while( pixels < total )
-               {
-                       for( int b = 31; b >= 0; b-- )
-                       {
-                               image[ pixels ++ ] = (compressed[data] & (0x1 << b))? 0xff: 0x00;
-                               
-                               if( pixels >= total )
-                               {
-                                       total = 0;
-                                       break;
-                               }
-                       }
-                       data++;
-               }
-               
-               glGenTextures( 1, &ui_glyph_texture );
-               glBindTexture( GL_TEXTURE_2D, ui_glyph_texture );
-               
-               glTexImage2D( GL_TEXTURE_2D, 0, GL_R8, 256, 256, 0, GL_RED, GL_UNSIGNED_BYTE, image );
-               
-               vg_tex2d_clamp();
-               vg_tex2d_nearest();
-               
-               free( image );
-       }
+   u32 compressed[] = {
+      #include "vg/vg_pxfont.h"
+   };
+
+   u32 pixels = 0, total = 256*256, data = 0;
+   u8 *image = malloc( total );
+   
+   while( pixels < total )
+   {
+      for( int b = 31; b >= 0; b-- )
+      {
+         image[ pixels ++ ] = (compressed[data] & (0x1 << b))? 0xff: 0x00;
+         
+         if( pixels >= total )
+         {
+            total = 0;
+            break;
+         }
+      }
+      data++;
+   }
+   
+   glGenTextures( 1, &ui_glyph_texture );
+   glBindTexture( GL_TEXTURE_2D, ui_glyph_texture );
+   
+   glTexImage2D( GL_TEXTURE_2D, 0, GL_R8, 256, 256, 0, GL_RED, GL_UNSIGNED_BYTE, image );
+   
+   vg_tex2d_clamp();
+   vg_tex2d_nearest();
+   
+   free( image );
        
        // Setup OpenGL memory
        SHADER_INIT( shader_ui );
@@ -279,8 +265,7 @@ static void ui_default_init(void)
 
 static void ui_default_free(void)
 {
-       if( !ui_glyph_override )        
-               glDeleteTextures( 1, &ui_glyph_texture );
+   glDeleteTextures( 1, &ui_glyph_texture );
        
        ui_context_free( &ui_global_ctx );
 }