More font changes, fixing spacing issue very soon...

This commit is contained in:
Ognjen Milan Robovic 2024-03-14 06:54:53 -04:00
parent a23e283a36
commit 0f3501011e
3 changed files with 19 additions and 10 deletions

View File

@ -86,7 +86,7 @@ package core is
text_box : volatile; text_box : volatile;
fonts : array (0 .. 4) of font; fonts : array (0 .. 5) of font;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------

View File

@ -29,11 +29,11 @@ begin
core.configure; core.configure;
ui.configure; ui.configure;
core.fonts (0) := core.load_font ("./font/pixel.ttf", 22, 2); core.fonts (1) := core.load_font ("./font/pixel.ttf", 12, 2);
core.fonts (1) := core.load_font ("./font/ferrum.ttf", 22, 2); core.fonts (2) := 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/gothic.ttf", 22, 2);
core.fonts (3) := core.load_font ("./font/unitblock.ttf", 22, 2); core.fonts (4) := core.load_font ("./font/unitblock.ttf", 22, 2);
core.fonts (4) := core.load_font ("./font/tenderness.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"))); 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 ("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 + 96, 16#CCCCCC#, core.fonts (3));
core.write ("Neon world!", 1600, 700 + 128, 16#CCCCCC#, core.fonts (4)); 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)); core.write ("Neon world!", 0, 0, 16#FFFFFF#, core.fonts (0));
end loop gameplay; end loop gameplay;

View File

@ -19,7 +19,7 @@ enum {
static int texture_count = 0; static int texture_count = 0;
static int sound_count = 0; static int sound_count = 0;
static int font_count = 0; static int font_count = 1;
static Texture2D * texture_array; static Texture2D * texture_array;
static Sound * sound_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; Vector2 position;
position.x = pad + x; position.x = ((font == 0) ? 4 : pad) + x;
position.y = pad + y; position.y = ((font == 0) ? 4 : pad) + y;
new_tint.r = ((colour & 0XFF0000) >> 16) % 256; new_tint.r = ((colour & 0XFF0000) >> 16) % 256;
new_tint.g = ((colour & 0X00FF00) >> 8) % 256; new_tint.g = ((colour & 0X00FF00) >> 8) % 256;
new_tint.b = ((colour & 0X0000FF) >> 0) % 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) { 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 = realloc (font_array, (unsigned long int) font_count * sizeof (* font_array));
font_array [font_count - 1] = LoadFont (path); 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); return (font_count - 1);
} }