diff --git a/source/core.ads b/source/core.ads index 842e85e..9593b5c 100644 --- a/source/core.ads +++ b/source/core.ads @@ -86,7 +86,7 @@ package core is text_box : volatile; - fonts : array (0 .. 4) of font; + fonts : array (0 .. 5) of font; ------------------------------------------------------------------------------------------ diff --git a/source/main.adb b/source/main.adb index 2bfdcf6..3860cb0 100644 --- a/source/main.adb +++ b/source/main.adb @@ -29,11 +29,11 @@ begin core.configure; ui.configure; - core.fonts (0) := core.load_font ("./font/pixel.ttf", 22, 2); - core.fonts (1) := core.load_font ("./font/ferrum.ttf", 22, 2); - core.fonts (2) := core.load_font ("./font/gothic.ttf", 22, 2); - core.fonts (3) := core.load_font ("./font/unitblock.ttf", 22, 2); - core.fonts (4) := core.load_font ("./font/tenderness.ttf", 22, 2); + core.fonts (1) := core.load_font ("./font/pixel.ttf", 12, 2); + core.fonts (2) := core.load_font ("./font/ferrum.ttf", 22, 2); + core.fonts (3) := core.load_font ("./font/gothic.ttf", 22, 2); + core.fonts (4) := core.load_font ("./font/unitblock.ttf", 22, 2); + core.fonts (5) := core.load_font ("./font/tenderness.ttf", 22, 2); core.play_sound (core.import_sound (core.c_string ("./song/main_menu.ogg"))); @@ -121,6 +121,7 @@ begin core.write ("Cyaa world!", 1600, 700 + 64, 16#CCCCCC#, core.fonts (2)); core.write ("Neon world!", 1600, 700 + 96, 16#CCCCCC#, core.fonts (3)); core.write ("Neon world!", 1600, 700 + 128, 16#CCCCCC#, core.fonts (4)); + core.write ("Neon world!", 1600, 700 + 160, 16#CCCCCC#, core.fonts (5)); core.write ("Neon world!", 0, 0, 16#FFFFFF#, core.fonts (0)); end loop gameplay; diff --git a/source/raylib.c b/source/raylib.c index 53f5427..52904bf 100644 --- a/source/raylib.c +++ b/source/raylib.c @@ -19,7 +19,7 @@ enum { static int texture_count = 0; static int sound_count = 0; -static int font_count = 0; +static int font_count = 1; static Texture2D * texture_array; static Sound * sound_array; @@ -116,14 +116,18 @@ void render_string (char * string, int x, int y, int colour, int font, int size, Vector2 position; - position.x = pad + x; - position.y = pad + y; + position.x = ((font == 0) ? 4 : pad) + x; + position.y = ((font == 0) ? 4 : pad) + y; new_tint.r = ((colour & 0XFF0000) >> 16) % 256; new_tint.g = ((colour & 0X00FF00) >> 8) % 256; new_tint.b = ((colour & 0X0000FF) >> 0) % 256; - DrawTextPro (font_array [font], string, position, dump, 0.0, size, 2 * pad, new_tint); + if (font == 0) { + DrawTextPro (GetFontDefault (), string, position, dump, 0.0, 22, 4, new_tint); + } else { + DrawTextPro (font_array [font], string, position, dump, 0.0, size, pad, new_tint); + } } void render_vector (int x1, int y1, int x2, int y2) { @@ -235,7 +239,11 @@ int import_font (char * path) { font_array = realloc (font_array, (unsigned long int) font_count * sizeof (* font_array)); font_array [font_count - 1] = LoadFont (path); +/* + GenTextureMipmaps (& font_array [font_count - 1].texture); + SetTextureFilter (font_array [font_count - 1].texture, TEXTURE_FILTER_POINT); +*/ return (font_count - 1); }