From: hgn Date: Thu, 20 Jan 2022 01:23:11 +0000 (+0000) Subject: new font X-Git-Url: https://harrygodden.com/git/?p=fishladder.git;a=commitdiff_plain;h=fdc58fb6b2fddec9e179baaba53e059ae1e54a54 new font --- diff --git a/build.sh b/build.sh index 63f64de..2a31674 100755 --- a/build.sh +++ b/build.sh @@ -88,6 +88,9 @@ done ../tools/texsheet ../_temp_textures/autocombine.qoi ../sprites_autocombine.h sprites_auto_combine $auto_combine cd .. +# Compile font file +./tools/fontcomp fonts/vg_font.png vg/vg_pxfont.h + # Main build if [ "$do_build" = true ]; then gcc -Wall -Wstrict-aliasing=3 $lib $flags $src gl/glad.c -o $target $libs $steam_part -Wl,-rpath=./ $defines diff --git a/fontcomp.c b/fontcomp.c index 73046b8..c2d26ac 100644 --- a/fontcomp.c +++ b/fontcomp.c @@ -39,7 +39,7 @@ int main( int argc, char *argv[] ) u32 buff = 0; for( int b = 31; b >= 0; b-- ) { - buff |= data[pixel*4+3]>128?0x1<128?0x1<= pixel_max ) @@ -56,6 +56,8 @@ int main( int argc, char *argv[] ) free(data); fclose(output); + + vg_success( "Font compiled successfully\n" ); } else { diff --git a/fonts/numbers/n0.h b/fonts/numbers/n0.h deleted file mode 100644 index 111d132..0000000 --- a/fonts/numbers/n0.h +++ /dev/null @@ -1,9 +0,0 @@ -/*triangle buffer generated from source file: 'models/n0.obj'*/ -0.500000f,-0.000000f,0.375000f,0.875000f,0.375000f,0.125000f, -0.500000f,1.000000f,0.125000f,0.875000f,0.375000f,0.875000f, -0.375000f,0.125000f,0.000000f,-0.000000f,0.500000f,-0.000000f, -0.000000f,-0.000000f,0.125000f,0.875000f,0.000000f,1.000000f, -0.500000f,-0.000000f,0.500000f,1.000000f,0.375000f,0.875000f, -0.500000f,1.000000f,0.000000f,1.000000f,0.125000f,0.875000f, -0.375000f,0.125000f,0.125000f,0.125000f,0.000000f,-0.000000f, -0.000000f,-0.000000f,0.125000f,0.125000f,0.125000f,0.875000f, diff --git a/fonts/numbers/n1.h b/fonts/numbers/n1.h deleted file mode 100644 index 6d395ae..0000000 --- a/fonts/numbers/n1.h +++ /dev/null @@ -1,5 +0,0 @@ -/*triangle buffer generated from source file: 'models/n1.obj'*/ -0.437500f,-0.000000f,0.312500f,0.875000f,0.312500f,-0.000000f, -0.312500f,0.875000f,0.250000f,1.000000f,0.250000f,0.875000f, -0.437500f,-0.000000f,0.437500f,1.000000f,0.312500f,0.875000f, -0.312500f,0.875000f,0.437500f,1.000000f,0.250000f,1.000000f, diff --git a/fonts/numbers/n2.h b/fonts/numbers/n2.h deleted file mode 100644 index a71391a..0000000 --- a/fonts/numbers/n2.h +++ /dev/null @@ -1,11 +0,0 @@ -/*triangle buffer generated from source file: 'models/n2.obj'*/ -0.500000f,0.437500f,0.375000f,0.875000f,0.375000f,0.562500f, -0.125000f,0.437500f,0.375000f,0.562500f,0.000000f,0.562500f, -0.125000f,0.125000f,0.000000f,0.562500f,0.000000f,-0.000000f, -0.375000f,0.875000f,0.000000f,1.000000f,0.000000f,0.875000f, -0.125000f,0.125000f,0.500000f,-0.000000f,0.500000f,0.125000f, -0.500000f,0.437500f,0.500000f,1.000000f,0.375000f,0.875000f, -0.125000f,0.437500f,0.500000f,0.437500f,0.375000f,0.562500f, -0.125000f,0.125000f,0.125000f,0.437500f,0.000000f,0.562500f, -0.375000f,0.875000f,0.500000f,1.000000f,0.000000f,1.000000f, -0.125000f,0.125000f,0.000000f,-0.000000f,0.500000f,-0.000000f, diff --git a/fonts/numbers/n3.h b/fonts/numbers/n3.h deleted file mode 100644 index fb91e11..0000000 --- a/fonts/numbers/n3.h +++ /dev/null @@ -1,12 +0,0 @@ -/*triangle buffer generated from source file: 'models/n3.obj'*/ -0.500000f,0.562500f,0.375000f,0.875000f,0.375000f,0.562500f, -0.000000f,0.437500f,0.375000f,0.562500f,0.000000f,0.562500f, -0.500000f,0.562500f,0.375000f,0.125000f,0.500000f,-0.000000f, -0.375000f,0.875000f,0.000000f,1.000000f,0.000000f,0.875000f, -0.375000f,0.562500f,0.375000f,0.437500f,0.500000f,0.562500f, -0.375000f,0.125000f,0.000000f,-0.000000f,0.500000f,-0.000000f, -0.500000f,0.562500f,0.500000f,1.000000f,0.375000f,0.875000f, -0.000000f,0.437500f,0.375000f,0.437500f,0.375000f,0.562500f, -0.500000f,0.562500f,0.375000f,0.437500f,0.375000f,0.125000f, -0.375000f,0.875000f,0.500000f,1.000000f,0.000000f,1.000000f, -0.375000f,0.125000f,0.000000f,0.125000f,0.000000f,-0.000000f, diff --git a/fonts/numbers/n4.h b/fonts/numbers/n4.h deleted file mode 100644 index 065737c..0000000 --- a/fonts/numbers/n4.h +++ /dev/null @@ -1,10 +0,0 @@ -/*triangle buffer generated from source file: 'models/n4.obj'*/ -0.125000f,0.562500f,0.000000f,1.000000f,0.000000f,0.437500f, -0.125000f,0.562500f,0.375000f,0.437500f,0.375000f,0.562500f, -0.375000f,0.562500f,0.375000f,0.437500f,0.500000f,0.562500f, -0.500000f,0.562500f,0.375000f,1.000000f,0.375000f,0.562500f, -0.375000f,0.437500f,0.500000f,-0.000000f,0.500000f,0.562500f, -0.125000f,0.562500f,0.125000f,1.000000f,0.000000f,1.000000f, -0.125000f,0.562500f,0.000000f,0.437500f,0.375000f,0.437500f, -0.500000f,0.562500f,0.500000f,1.000000f,0.375000f,1.000000f, -0.375000f,0.437500f,0.375000f,-0.000000f,0.500000f,-0.000000f, diff --git a/fonts/numbers/n5.h b/fonts/numbers/n5.h deleted file mode 100644 index 176aed8..0000000 --- a/fonts/numbers/n5.h +++ /dev/null @@ -1,11 +0,0 @@ -/*triangle buffer generated from source file: 'models/n5.obj'*/ -0.125000f,0.875000f,0.000000f,0.437500f,0.125000f,0.562500f, -0.125000f,0.562500f,0.375000f,0.437500f,0.500000f,0.562500f, -0.500000f,0.562500f,0.375000f,0.125000f,0.500000f,-0.000000f, -0.125000f,0.875000f,0.500000f,1.000000f,0.000000f,1.000000f, -0.375000f,0.125000f,0.000000f,-0.000000f,0.500000f,-0.000000f, -0.125000f,0.875000f,0.000000f,1.000000f,0.000000f,0.437500f, -0.125000f,0.562500f,0.000000f,0.437500f,0.375000f,0.437500f, -0.500000f,0.562500f,0.375000f,0.437500f,0.375000f,0.125000f, -0.125000f,0.875000f,0.500000f,0.875000f,0.500000f,1.000000f, -0.375000f,0.125000f,0.000000f,0.125000f,0.000000f,-0.000000f, diff --git a/fonts/numbers/n6.h b/fonts/numbers/n6.h deleted file mode 100644 index 675ea5b..0000000 --- a/fonts/numbers/n6.h +++ /dev/null @@ -1,14 +0,0 @@ -/*triangle buffer generated from source file: 'models/n6.obj'*/ -0.500000f,0.562500f,0.375000f,0.125000f,0.500000f,-0.000000f, -0.125000f,0.125000f,0.500000f,-0.000000f,0.375000f,0.125000f, -0.125000f,0.437500f,0.000000f,-0.000000f,0.125000f,0.125000f, -0.125000f,0.437500f,0.125000f,0.562500f,0.000000f,0.562500f, -0.125000f,0.562500f,0.375000f,0.437500f,0.500000f,0.562500f, -0.125000f,0.875000f,0.000000f,0.562500f,0.125000f,0.562500f, -0.125000f,0.875000f,0.500000f,1.000000f,0.000000f,1.000000f, -0.500000f,0.562500f,0.375000f,0.437500f,0.375000f,0.125000f, -0.125000f,0.125000f,0.000000f,-0.000000f,0.500000f,-0.000000f, -0.125000f,0.437500f,0.000000f,0.562500f,0.000000f,-0.000000f, -0.125000f,0.562500f,0.125000f,0.437500f,0.375000f,0.437500f, -0.125000f,0.875000f,0.000000f,1.000000f,0.000000f,0.562500f, -0.125000f,0.875000f,0.500000f,0.875000f,0.500000f,1.000000f, diff --git a/fonts/numbers/n7.h b/fonts/numbers/n7.h deleted file mode 100644 index f3016f3..0000000 --- a/fonts/numbers/n7.h +++ /dev/null @@ -1,5 +0,0 @@ -/*triangle buffer generated from source file: 'models/n7.obj'*/ -0.500000f,-0.000000f,0.375000f,0.875000f,0.375000f,-0.000000f, -0.375000f,0.875000f,0.000000f,1.000000f,0.000000f,0.875000f, -0.500000f,-0.000000f,0.500000f,1.000000f,0.375000f,0.875000f, -0.375000f,0.875000f,0.500000f,1.000000f,0.000000f,1.000000f, diff --git a/fonts/numbers/n8.h b/fonts/numbers/n8.h deleted file mode 100644 index e7f5957..0000000 --- a/fonts/numbers/n8.h +++ /dev/null @@ -1,17 +0,0 @@ -/*triangle buffer generated from source file: 'models/n8.obj'*/ -0.500000f,0.562500f,0.375000f,0.125000f,0.500000f,-0.000000f, -0.125000f,0.125000f,0.500000f,-0.000000f,0.375000f,0.125000f, -0.125000f,0.437500f,0.000000f,-0.000000f,0.125000f,0.125000f, -0.125000f,0.437500f,0.125000f,0.562500f,0.000000f,0.562500f, -0.125000f,0.562500f,0.375000f,0.437500f,0.375000f,0.562500f, -0.125000f,0.875000f,0.000000f,0.562500f,0.125000f,0.562500f, -0.375000f,0.875000f,0.000000f,1.000000f,0.125000f,0.875000f, -0.500000f,0.562500f,0.375000f,0.562500f,0.375000f,0.437500f, -0.375000f,0.875000f,0.500000f,0.562500f,0.500000f,1.000000f, -0.500000f,0.562500f,0.375000f,0.437500f,0.375000f,0.125000f, -0.125000f,0.125000f,0.000000f,-0.000000f,0.500000f,-0.000000f, -0.125000f,0.437500f,0.000000f,0.562500f,0.000000f,-0.000000f, -0.125000f,0.562500f,0.125000f,0.437500f,0.375000f,0.437500f, -0.125000f,0.875000f,0.000000f,1.000000f,0.000000f,0.562500f, -0.375000f,0.875000f,0.500000f,1.000000f,0.000000f,1.000000f, -0.375000f,0.875000f,0.375000f,0.562500f,0.500000f,0.562500f, diff --git a/fonts/numbers/n9.h b/fonts/numbers/n9.h deleted file mode 100644 index ccc3e6c..0000000 --- a/fonts/numbers/n9.h +++ /dev/null @@ -1,14 +0,0 @@ -/*triangle buffer generated from source file: 'models/n9.obj'*/ -0.000000f,1.000000f,0.125000f,0.562500f,0.125000f,0.875000f, -0.375000f,0.875000f,0.000000f,1.000000f,0.125000f,0.875000f, -0.375000f,0.875000f,0.500000f,0.437500f,0.500000f,1.000000f, -0.375000f,0.562500f,0.375000f,0.437500f,0.500000f,0.437500f, -0.375000f,0.437500f,0.125000f,0.562500f,0.000000f,0.437500f, -0.375000f,0.125000f,0.500000f,0.437500f,0.375000f,0.437500f, -0.375000f,0.125000f,0.000000f,-0.000000f,0.500000f,-0.000000f, -0.000000f,1.000000f,0.000000f,0.437500f,0.125000f,0.562500f, -0.375000f,0.875000f,0.500000f,1.000000f,0.000000f,1.000000f, -0.375000f,0.875000f,0.375000f,0.562500f,0.500000f,0.437500f, -0.375000f,0.437500f,0.375000f,0.562500f,0.125000f,0.562500f, -0.375000f,0.125000f,0.500000f,-0.000000f,0.500000f,0.437500f, -0.375000f,0.125000f,0.000000f,0.125000f,0.000000f,-0.000000f, diff --git a/fonts/vg_font.png b/fonts/vg_font.png new file mode 100644 index 0000000..282b38a Binary files /dev/null and b/fonts/vg_font.png differ diff --git a/vg/vg_console.h b/vg/vg_console.h index 76d3800..a1ce406 100644 --- a/vg/vg_console.h +++ b/vg/vg_console.h @@ -102,17 +102,19 @@ static void vg_console_draw( void ) return; int ptr = vg_console.current-1; + + int const fh = 14; ui_global_ctx.cursor[0] = 0; ui_global_ctx.cursor[1] = 0; - ui_global_ctx.cursor[3] = vg_list_size( vg_console.lines )*8*vg_console.scale; + ui_global_ctx.cursor[3] = vg_list_size( vg_console.lines )*fh*vg_console.scale; ui_fill_x( &ui_global_ctx ); ui_new_node( &ui_global_ctx ); { ui_fill_rect( &ui_global_ctx, ui_global_ctx.cursor, 0x77333333 ); - ui_global_ctx.cursor[3] = 8*vg_console.scale; + ui_global_ctx.cursor[3] = fh*vg_console.scale; ui_align_bottom( &ui_global_ctx ); for( int i = 0; i < vg_console.len; i ++ ) @@ -121,7 +123,7 @@ static void vg_console_draw( void ) ptr = vg_list_size( vg_console.lines )-1; ui_text( &ui_global_ctx, vg_console.lines[ptr], vg_console.scale ); - ui_global_ctx.cursor[1] -= 8*vg_console.scale; + ui_global_ctx.cursor[1] -= fh*vg_console.scale; ptr --; } @@ -129,7 +131,7 @@ static void vg_console_draw( void ) ui_end_down( &ui_global_ctx ); ui_global_ctx.cursor[1] += 2; - ui_global_ctx.cursor[3] = 8*vg_console.scale; + ui_global_ctx.cursor[3] = fh*vg_console.scale; ui_new_node( &ui_global_ctx ); { @@ -140,8 +142,8 @@ static void vg_console_draw( void ) int start = VG_MIN( vg_console.cursor_pos, vg_console.cursor_user ), end = VG_MAX( vg_console.cursor_pos, vg_console.cursor_user ); - ui_global_ctx.cursor[0] = (start * ui_glyph_spacing_x * vg_console.scale) + 2; - ui_global_ctx.cursor[2] = (start == end? 0.2f: (float)(end-start)) * (float)ui_glyph_spacing_x * (float)vg_console.scale * 0.5f; + ui_global_ctx.cursor[0] = (start * ui_glyph_spacing_x * vg_console.scale); + ui_global_ctx.cursor[2] = (start == end? 0.5f: (float)(end-start)) * (float)ui_glyph_spacing_x * (float)vg_console.scale; ui_fill_rect( &ui_global_ctx, ui_global_ctx.cursor, 0x66ffffff ); } @@ -178,6 +180,14 @@ static int vg_console_list( int argc, char const *argv[] ) return 0; } +static int vg_console_chartest( int argc, char const *argv[] ) +{ + vg_info( "\"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG\"\n" ); + vg_info( "'the quick brown fox jumps over the lazy dog'\n" ); + vg_info( ":;!@#$%^& 0123456789 +-*/=~ ()[]{}<>\n" ); + return 0; +} + static void vg_console_init(void) { vg_log_callback = vg_console_println; @@ -191,6 +201,11 @@ static void vg_console_init(void) .function = vg_console_list }); + vg_function_push( (struct vg_cmd){ + .name = "chartest", + .function = vg_console_chartest + }); + // Read and exec persistent commands FILE *fp = fopen( "cfg/auto.conf", "r" ); if( fp ) diff --git a/vg/vg_pxfont.h b/vg/vg_pxfont.h new file mode 100644 index 0000000..9333877 --- /dev/null +++ b/vg/vg_pxfont.h @@ -0,0 +1,257 @@ +/* Font buffer generated from source file: 'fonts/vg_font.png' */ +0xffff0000,0,0,0,0,0,0,0, +0xffff0000,0,0,0,0,0,0,0, +0xffff0000,0,0,0,0,0,0,0, +0xffff0000,0,0,0,0,0,0,0, +0xffff0c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30, +0xffff0810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810, +0xffff0000,0,0,0,0,0,0,0, +0xffff0040,0x8000c0,0x1000140,0x18001c0,0x2000240,0x28002c0,0x3000340,0x38003c0, +0xffff0000,0,0,0,0,0,0,0, +0xffff0000,0,0,0,0,0,0,0, +0xffff0000,0,0,0,0,0,0,0, +0xffff0000,0,0,0,0,0,0,0, +0xffff0810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810, +0xffff0c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30, +0xffff0000,0,0,0,0,0,0,0, +0xffff0000,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30, +0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810, +0x400040,0x400040,0x400040,0x400040,0x400040,0x400040,0x400040,0x400040, +0x40,0x8000c0,0x1000140,0x18001c0,0x2000240,0x28002c0,0x3000340,0x38003c0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810,0x8100810, +0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30,0xc300c30, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0x6600000,0x1800000,0x180,0,0,0,0, +0,0x6600000,0x1800000,0x180,0x1c00380,0,0,0, +0xc300180,0x6600660,0x3c00660,0x3c00180,0x38001c0,0x800000,0,0x60, +0x8100180,0x2200660,0x7e00660,0x7e00080,0x30000c0,0x2a00180,0,0x60, +0x800180,0xff0,0x60000e0,0x6600000,0x6000060,0x1c00180,0,0xe0, +0x180,0xff0,0x60000c0,0x6600000,0x6000060,0x1c00180,0,0xc0, +0x180,0x660,0x7c00180,0x3200000,0x6000060,0x2a00ff0,0x7e0,0x180, +0x180,0x660,0x3e00180,0x3800000,0x6000060,0x800ff0,0x7e0,0x180, +0,0xff0,0x600300,0x6c00000,0x6000060,0x180,0,0x300, +0,0xff0,0x600700,0x6600000,0x6000060,0x180,0,0x700, +0x8100180,0x660,0x7e00660,0x7f00000,0x30000c0,0x180,0x1800000,0x1800600, +0xc300180,0x660,0x3c00660,0x3b00000,0x38001c0,0,0x1800000,0x1800600, +0,0,0x1800000,0,0x1c00380,0,0x1000000,0, +0,0,0x1800000,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0x3c00180,0x3c003c0,0xe007c0,0x3c007c0,0x3c003c0,0,0x600000,0x60003e0, +0x7e00380,0x7e007e0,0x1e007e0,0x7e007e0,0x7e007e0,0,0xe00000,0x70007f0, +0x6600380,0x4600060,0x3e00600,0x6000060,0x6600660,0x1800180,0x1c007e0,0x3800630, +0xcf00180,0x600060,0x7600600,0x6000060,0x6600660,0x1800180,0x38007e0,0x1c00030, +0xdf00180,0xe001e0,0xe6007c0,0x7c000c0,0x7e007e0,0,0x7000000,0xe000f0, +0xfb00180,0x1c001e0,0xff007e0,0x7e000c0,0x7e007e0,0,0x7000000,0xe001e0, +0xf300180,0x3800060,0xff00060,0x6600180,0x6600060,0x1800180,0x38007e0,0x1c00180, +0x6600180,0x7000060,0x600060,0x6600180,0x6600060,0x1800180,0x1c007e0,0x3800000, +0x7e003c0,0x7e007e0,0x6007e0,0x7e00300,0x7e007e0,0x80,0xe00000,0x7000180, +0x3c003c0,0x7e003c0,0x6003c0,0x3c00300,0x3c003c0,0,0x600000,0x6000180, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0x3c0,0x7c001c0,0x78007e0,0x3e003e0,0x66007e0,0x7e00660,0x6000660,0x3c003c0, +0x3c007e0,0x7e003e0,0x7c007e0,0x3e007f0,0x66007e0,0x3e00660,0x6000ff0,0x7e007e0, +0x7e00660,0x6600700,0x6e00600,0x3000e00,0x6600180,0x6006c0,0x6000ff0,0x6600e70, +0x300660,0x6600600,0x6600600,0x3000c00,0x6600180,0x6007c0,0x6000db0,0x6600c30, +0x3b00660,0x7e00600,0x66007c0,0x3e00c00,0x7e00180,0x600780,0x6000db0,0x6600c30, +0x7f007e0,0x7c00600,0x66007c0,0x3e00c70,0x7e00180,0x600780,0x6000db0,0x6600c30, +0x67007e0,0x6600600,0x6600600,0x3000c30,0x6600180,0x6007c0,0x6000c30,0x6600c30, +0x7f00660,0x6600700,0x6e00600,0x3000e30,0x6600180,0xe006c0,0x6000c30,0x6600e70, +0x3e00660,0x7e003e0,0x7c007e0,0x30007e0,0x66007e0,0x7c00660,0x7e00c30,0x66007e0, +0x660,0x7c001c0,0x78007e0,0x30003c0,0x66007e0,0x7800660,0x3e00c30,0x66003c0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0x3c0,0x3c0,0x1800000, +0x7c003c0,0x3c003c0,0x7e00660,0x6600c30,0xc300660,0x7e003c0,0x60003c0,0x3c00000, +0x7e007e0,0x7e007e0,0x7e00660,0x6600c30,0xe700660,0x3e00380,0x60001c0,0x3c00000, +0x6600660,0x6600600,0x1800660,0x6600c30,0x6600660,0xc00300,0x70000c0,0x6600000, +0x6600660,0x6600600,0x1800660,0x6600c30,0x7e00660,0xc00300,0x30000c0,0x4200000, +0x6600660,0x7e007c0,0x1800660,0x6600db0,0x3c007e0,0x1800300,0x18000c0,0, +0x7e006e0,0x7c003e0,0x1800660,0x6600db0,0x3c003e0,0x1800300,0x18000c0,0, +0x7c006e0,0x6c00060,0x1800660,0x6600db0,0x7e00060,0x3000300,0xc000c0,0, +0x6000670,0x6e00060,0x1800660,0x7e00ff0,0x6600060,0x3000300,0xe000c0,0, +0x60007b0,0x66007e0,0x18007e0,0x3c00ff0,0xe7007e0,0x7c00380,0x6001c0,0, +0x60003d0,0x66003c0,0x18003c0,0x1800660,0xc3003c0,0x7e003c0,0x6003c0,0xff0, +0,0,0,0,0,0x3c0,0x3c0,0xff0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0x3000000,0,0,0,0,0,0,0, +0x3000000,0,0,0,0,0,0,0, +0x1800000,0x6000000,0x600000,0,0x6000180,0x1800600,0x6000000,0, +0x800000,0x6000000,0x600000,0,0x6000180,0x1800600,0x6000000,0, +0x1c0,0x60003c0,0x6003c0,0x1e003c0,0x6000000,0x600,0x60007e0,0x3c007e0, +0x3e0,0x7c007e0,0x3e007e0,0x3e007e0,0x6000380,0x38006e0,0x6000ff0,0x7e00ff0, +0x60,0x7e00600,0x7e00660,0x3000660,0x7c00180,0x18007c0,0x6000db0,0x7e00e70, +0x3e0,0x6600600,0x66006e0,0x3000660,0x7e00180,0x1800780,0x6000db0,0x6600c30, +0x660,0x6600600,0x66007c0,0x3000660,0x6600180,0x18007c0,0x6000c30,0x6600c30, +0x660,0x6600600,0x6600700,0x3e007e0,0x6600180,0x18006c0,0x6000c30,0x6600e70, +0x7e0,0x7e007e0,0x7e003e0,0x3c003e0,0x6600180,0x1800660,0x7e00c30,0x6600ff0, +0x3e0,0x7c003c0,0x3e001c0,0x3000060,0x6600180,0x1800660,0x3e00c30,0x66007e0, +0,0,0,0x70007e0,0,0x3800000,0,0, +0,0,0,0x60003c0,0,0x3000000,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0xc0,0x300,0, +0,0,0x3000000,0,0,0x1c0,0x1800380,0, +0,0,0x3000000,0,0,0x180,0x1800180,0, +0x3c003c0,0x1c001c0,0x3000660,0xc300c30,0xc300660,0x7e00180,0x1800180,0, +0x7e007e0,0x3c003c0,0x3000660,0xc300c30,0xe700660,0x7e00380,0x18001c0,0x7300000, +0x6600660,0x3000300,0x3c00660,0x6600c30,0x7e00660,0xe00700,0x18000e0,0xfb00000, +0x6600660,0x3000380,0x3c00660,0x6600c30,0x3c00660,0x1c00700,0x18000e0,0xdf00000, +0x6600660,0x30001c0,0x3000660,0x6600db0,0x3c00660,0x3800380,0x18001c0,0xce00000, +0x6600660,0x30000c0,0x3000660,0x3c00db0,0x7e007e0,0x7000180,0x1800180,0, +0x7e007e0,0x30003c0,0x3c007e0,0x3c00ff0,0xe7003e0,0x7e00180,0x1800180,0, +0x7c003e0,0x3000380,0x1c003c0,0x1800660,0xc300060,0x7e001c0,0x1800380,0, +0x6000060,0,0,0,0x7e0,0xc0,0x300,0, +0x6000060,0,0,0,0x3c0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, diff --git a/vg/vg_ui.h b/vg/vg_ui.h index f6693cb..d4fb20b 100644 --- a/vg/vg_ui.h +++ b/vg/vg_ui.h @@ -17,7 +17,7 @@ SHADER_DEFINE( shader_ui, "void main()" "{" "gl_Position = vec4( uPv * vec3( a_co, 1.0 ), 1.0 );" - "aTexCoords = a_uv * 0.01388888888;" + "aTexCoords = a_uv * 0.0078125;" "aColour = a_colour;" "aWsp = a_co;" @@ -149,7 +149,7 @@ struct ui_ctx // Opengl int ui_glyph_override = 0; -ui_px ui_glyph_spacing_x = 6; +ui_px ui_glyph_spacing_x = 9; GLuint ui_glyph_texture = 0; ui_colourset ui_default_colours = { @@ -240,10 +240,10 @@ static void ui_default_init(void) if( !ui_glyph_override ) { u32 compressed[] = { - #include "fonts/weiholmir.h" + #include "vg/vg_pxfont.h" }; - u32 pixels = 0, total = 72*72, data = 0; + u32 pixels = 0, total = 256*256, data = 0; u8 *image = malloc( total ); while( pixels < total ) @@ -264,7 +264,7 @@ static void ui_default_init(void) glGenTextures( 1, &ui_glyph_texture ); glBindTexture( GL_TEXTURE_2D, ui_glyph_texture ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_R8, 72, 72, 0, GL_RED, GL_UNSIGNED_BYTE, image ); + glTexImage2D( GL_TEXTURE_2D, 0, GL_R8, 256, 256, 0, GL_RED, GL_UNSIGNED_BYTE, image ); vg_tex2d_clamp(); vg_tex2d_nearest(); @@ -567,7 +567,7 @@ static struct ui_vert *ui_fill_rect_uv( ui_ctx *ctx, ui_rect rect, u32 colour, u static struct ui_vert *ui_fill_rect( ui_ctx *ctx, ui_rect rect, u32 colour ) { - return ui_fill_rect_uv( ctx, rect, colour, (ui_px[4]){ 4,124,4,124 } ); + return ui_fill_rect_uv( ctx, rect, colour, (ui_px[4]){ 4,4, 4,4 } ); } static void ui_text( ui_ctx *ctx, const char *str, ui_px scale ) @@ -576,8 +576,8 @@ static void ui_text( ui_ctx *ctx, const char *str, ui_px scale ) text_cursor[0] = ctx->cursor[0]; text_cursor[1] = ctx->cursor[1]; - text_cursor[2] = 7*scale; - text_cursor[3] = 7*scale; + text_cursor[2] = 8*scale; + text_cursor[3] = 14*scale; u32 current_colour = 0x00ffffff; @@ -587,21 +587,21 @@ static void ui_text( ui_ctx *ctx, const char *str, ui_px scale ) { if( c == '\n' ) { - text_cursor[1] += 10*scale; + text_cursor[1] += 14*scale; text_cursor[0] = ctx->cursor[0]; continue; } else if( c >= 33 && c <= 126 ) { u8 glyph_base[2]; - u8 glyph_index = c - 32; - glyph_base[0] = glyph_index%10; - glyph_base[1] = (glyph_index-glyph_base[0])/10; + u8 glyph_index = c; + glyph_base[0] = glyph_index & 0xf; + glyph_base[1] = (glyph_index-glyph_base[0])>>4; - glyph_base[0] *= 7; - glyph_base[1] *= 7; + glyph_base[0] *= 8; + glyph_base[1] *= 8; - ui_fill_rect_uv( ctx, text_cursor, current_colour, (ui_px[4]){glyph_base[0],glyph_base[1],glyph_base[0]+7,glyph_base[1]+7} ); + ui_fill_rect_uv( ctx, text_cursor, current_colour, (ui_px[4]){glyph_base[0]+2,glyph_base[1]+1,glyph_base[0]+6,glyph_base[1]+8} ); } else if( c == '\x1B' ) { @@ -640,7 +640,7 @@ static void ui_text( ui_ctx *ctx, const char *str, ui_px scale ) } } - text_cursor[0] += 6*scale; + text_cursor[0] += 9*scale; } }