Experimenting with PNG fonts...

This commit is contained in:
Ognjen Milan Robovic 2024-03-14 07:58:52 -04:00
parent 3d824efb4e
commit 1b5ff7cc8b
7 changed files with 16 additions and 28 deletions

BIN
font/alagard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
font/courier.ttf Normal file

Binary file not shown.

View File

@ -86,16 +86,16 @@ package body core is
procedure draw_state_box (x, y : in integer) is
begin
write ("Cursor X :" & integer'image (cursor_x), x, y + 0, 16#CCCCCC#);
write ("Cursor Y :" & integer'image (cursor_y), x, y + 32, 16#CCCCCC#);
write ("Cursor Mode :" & integer'image (cursor_mode), x, y + 64, 16#CCCCCC#);
write ("Signal Code :" & signal_code'image (signal_code'val (signal_mode)), x, y + 96, 16#CCCCCC#);
write ("Camera X :" & integer'image (camera.x), x, y + 128, 16#CCCCCC#);
write ("Camera Y :" & integer'image (camera.y), x, y + 160, 16#CCCCCC#);
write ("Global Time :" & integer'image (global_time), x, y + 192, 16#CCCCCC#);
write ("Gameplay Time :" & integer'image (gameplay_time), x, y + 224, 16#CCCCCC#);
write ("Animation Time :" & integer'image (animation_time), x, y + 256, 16#CCCCCC#);
write ("Framerate :" & integer'image (framerate), x, y + 288, 16#CCCCCC#);
write ("Cursor X :" & integer'image (cursor_x), x, y + 0);
write ("Cursor Y :" & integer'image (cursor_y), x, y + 32);
write ("Cursor Mode :" & integer'image (cursor_mode), x, y + 64);
write ("Signal Code : " & signal_code'image (signal_code'val (signal_mode)), x, y + 96);
write ("Camera X :" & integer'image (camera.x), x, y + 128);
write ("Camera Y :" & integer'image (camera.y), x, y + 160);
write ("Global Time :" & integer'image (global_time), x, y + 192);
write ("Gameplay Time :" & integer'image (gameplay_time), x, y + 224);
write ("Animation Time :" & integer'image (animation_time), x, y + 256);
write ("Framerate :" & integer'image (framerate), x, y + 288);
end draw_state_box;
------------------------------------------------------------------------------------------
@ -219,7 +219,7 @@ package body core is
------------------------------------------------------------------------------------------
procedure write (text : in string; x, y : in integer; colour : in integer := 16#A37A28#; data : in font := fonts (0)) is
procedure write (text : in string; x, y : in integer; colour : in integer := 16#FFFFFF#; data : in font := fonts (1)) is
begin
render_string (c_string (text), x, y, colour, data.index, data.size, data.pad);
end write;

View File

@ -155,7 +155,7 @@ package core is
procedure line (origin, offset : in vector_2);
procedure write (text : in string; x, y : in integer; colour : in integer := 16#A37A28#; data : in font := fonts (0));
procedure write (text : in string; x, y : in integer; colour : in integer := 16#FFFFFF#; data : in font := fonts (1));
procedure debug (text : in string);
procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean);

View File

@ -29,11 +29,7 @@ begin
core.configure;
ui.configure;
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.fonts (1) := core.load_font ("./font/alagard.png", 24, 0);
core.play_sound (core.import_sound (core.c_string ("./song/main_menu.ogg")));
@ -115,14 +111,6 @@ begin
--~might.menu (0, 0, true);
--
ui.draw_text_box (0, core.window_height - 32, core.window_width, 32);
--
core.write ("Heyo world!", 1600, 700 + 0, 16#CCCCCC#, core.fonts (0));
core.write ("Nyaa world!", 1600, 700 + 32, 16#CCCCCC#, core.fonts (1));
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;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -132,7 +132,7 @@ package body ui is
draw (text_lower_left, x, y + height - offset);
draw (text_lower_right, x + width - offset, y + height - offset);
--
core.write (core.read_text_box, x, y, 16#999999#);
core.write (core.read_text_box, x, y);
end draw_text_box;
------------------------------------------------------------------------------------------
@ -170,7 +170,7 @@ package body ui is
--
draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width);
--
core.write (title, x + sprite (active, title_bar_left).width - 12, y - sprite (active, title_bar_middle).height + 24, 16#C9952D#);
core.write (title, x + sprite (active, title_bar_left).width - 12, y - sprite (active, title_bar_middle).height + 24);
end draw_title_bar;
------------------------------------------------------------------------------------------

View File

@ -102,7 +102,7 @@ package body unit is
ui.draw_icon (attribute.trait (data).text, move_x + view_width + 12 + offset, move_y + offset + move);
attribute.draw (data, move_x + view_width + 12 + offset, move_y + offset + move);
--
core.write (integer'image (trait (index).attributes (data)), move_x + view_width + 12 + offset + core.icon, move_y + offset + move, 16#999999#);
core.write (integer'image (trait (index).attributes (data)), move_x + view_width + 12 + offset + core.icon, move_y + offset + move);
end loop;
for animate in animation
loop