No need for font folder, bound to UI style...

This commit is contained in:
Ognjen Milan Robovic 2024-03-14 14:40:05 -04:00
parent b8020aef2f
commit 37f0cb4e17
21 changed files with 37 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -39,7 +39,7 @@ package body attribute is
loop
ui.draw_icon (trait (index).text, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon, ui.font (ui.active));
end loop;
end menu;

View File

@ -84,22 +84,6 @@ package body core is
------------------------------------------------------------------------------------------
procedure draw_state_box (x, y : in integer) is
begin
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;
------------------------------------------------------------------------------------------
function flip_coin return integer is
begin
return (random_integer (0, 1));
@ -219,7 +203,7 @@ package body core is
------------------------------------------------------------------------------------------
procedure write (text : in string; x, y : in integer; colour : in integer := 16#FFFFFF#; data : in font := fonts (1)) is
procedure write (text : in string; x, y : in integer; data : in font; colour : in integer := 16#FFFFFF#) is
begin
render_string (c_string (text), x, y, colour, data.index, data.size, data.pad);
end write;

View File

@ -86,8 +86,6 @@ package core is
text_box : volatile;
fonts : array (0 .. 5) of font;
------------------------------------------------------------------------------------------
-- C
@ -135,8 +133,6 @@ package core is
procedure configure;
procedure synchronize;
procedure draw_state_box (x, y : in integer);
function flip_coin return integer;
function roll_dice return integer;
function by_chance (chance : in integer) return integer;
@ -155,7 +151,7 @@ package core is
procedure line (origin, offset : in vector_2);
procedure write (text : in string; x, y : in integer; colour : in integer := 16#FFFFFF#; data : in font := fonts (1));
procedure write (text : in string; x, y : in integer; data : in font; colour : in integer := 16#FFFFFF#);
procedure debug (text : in string);
procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean);

View File

@ -68,7 +68,7 @@ package body magic is
for index in codex
loop
icon (index, move_x + offset + school'pos (trait (index).kind) * 168, move_y + offset + next (school'pos (trait (index).kind)) * core.icon);
core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon);
core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon, ui.font (ui.active));
--
next (school'pos (trait (index).kind)) := next (school'pos (trait (index).kind)) + 1;
end loop;

View File

@ -29,9 +29,6 @@ begin
core.configure;
ui.configure;
core.fonts (1) := core.load_font ("./font/alagard.png", 24, 0);
--~core.fonts (1) := core.load_font ("./font/gothica.png", 24, 0);
core.play_sound (core.import_sound (core.c_string ("./song/main_menu.ogg")));
attribute.configure;
@ -96,7 +93,7 @@ begin
--~for index in resource.codex loop resource.draw (index, 32 * resource.codex'pos (index) + 64, 96); end loop;
--~for index in skill.codex loop skill.draw (index, 32 * skill.codex'pos (index) + 64, 128); end loop;
--
core.draw_state_box (preview_width + 32, 32);
ui.draw_state_box (preview_width + 32, 32);
--
attribute.menu (300, 200, false);
skill.menu (600, 300, true);

View File

@ -68,7 +68,7 @@ package body might is
for index in codex
loop
icon (index, move_x + offset + school'pos (trait (index).kind) * 168, move_y + offset + next (school'pos (trait (index).kind)) * core.icon);
core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon);
core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon, ui.font (ui.active));
--
next (school'pos (trait (index).kind)) := next (school'pos (trait (index).kind)) + 1;
end loop;

View File

@ -39,7 +39,7 @@ package body resource is
loop
ui.draw_icon (trait (index).text, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon, ui.font (ui.active));
end loop;
end menu;

View File

@ -39,7 +39,7 @@ package body skill is
loop
ui.draw_icon (trait (index).text, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon, ui.font (ui.active));
end loop;
end menu;

View File

@ -87,6 +87,8 @@ package body ui is
procedure configure is
procedure load_ui (index : in style; folder_path : in string) is
begin
font (index) := core.load_font ("./sprite/ui/" & folder_path & "/font.png", 24, 0);
--
for this in codex
loop
sprite (index, this) := core.load_sprite ("./sprite/ui/" & folder_path & core.lowercase (codex'image (this)) & ".png", 1, 1);
@ -132,7 +134,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);
core.write (core.read_text_box, x, y, font (active));
--
select_text_box ("", x, y, width, height);
end draw_text_box;
@ -172,7 +174,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 / 2, y - sprite (active, title_bar_middle).height / 2 - 4);
core.write (title, x + sprite (active, title_bar_left).width / 2, y - sprite (active, title_bar_middle).height / 2 - 4, font (active));
--
select_text_box ("", x, y - sprite (active, title_bar_middle).height, width, sprite (active, title_bar_middle).height);
end draw_title_bar;
@ -283,6 +285,22 @@ package body ui is
select_text_box (description, x, y, width, height);
end draw_icon_menu;
------------------------------------------------------------------------------------------
procedure draw_state_box (x, y : in integer) is
begin
core.write ("Cursor X :" & integer'image (core.cursor_x), x, y + 0, font (active));
core.write ("Cursor Y :" & integer'image (core.cursor_y), x, y + 32, font (active));
core.write ("Cursor Mode :" & integer'image (core.cursor_mode), x, y + 64, font (active));
core.write ("Signal Code :" & core.signal_code'image (core.signal_code'val (core.signal_mode)), x, y + 96, font (active));
core.write ("Camera X :" & integer'image (core.camera.x), x, y + 128, font (active));
core.write ("Camera Y :" & integer'image (core.camera.y), x, y + 160, font (active));
core.write ("Global Time :" & integer'image (core.global_time), x, y + 192, font (active));
core.write ("Gameplay Time :" & integer'image (core.gameplay_time), x, y + 224, font (active));
core.write ("Animation Time :" & integer'image (core.animation_time), x, y + 256, font (active));
core.write ("Framerate :" & integer'image (core.framerate), x, y + 288, font (active));
end draw_state_box;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end ui;

View File

@ -33,11 +33,13 @@ package ui is
------------------------------------------------------------------------------------------
type sprite_array is array (style, codex) of core.sprite;
type font_array is array (style) of core.font;
------------------------------------------------------------------------------------------
sprite : sprite_array;
active : style;
sprite : sprite_array;
font : font_array;
active : style;
------------------------------------------------------------------------------------------
@ -58,6 +60,8 @@ package ui is
procedure draw_icon_menu (description : in string; x, y, width, height : in integer);
procedure draw_state_box (x, y : in integer);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end ui;

View File

@ -76,7 +76,7 @@ package body unit is
move := faction.codex'pos (trait (index).kind) * 168;
--
icon (index, move_x + offset + move, move_y + offset + (codex'pos (index) mod 14) * core.icon);
core.write (trait (index).name, move_x + offset + move + core.icon, move_y + offset + (codex'pos (index) mod 14) * core.icon);
core.write (trait (index).name, move_x + offset + move + core.icon, move_y + offset + (codex'pos (index) mod 14) * core.icon, ui.font (ui.active));
end loop;
end menu;
@ -102,8 +102,9 @@ 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);
core.write (integer'image (trait (index).attributes (data)), move_x + view_width + 12 + offset + core.icon, move_y + offset + move, ui.font (ui.active));
end loop;
--
for animate in animation
loop
draw (index, animate, move_x + offset + animation'pos (animate) * (sprite (index).width + 8), move_y + offset + 8 + core.icon * attribute.count);