Source changes now, loading of new assets and usage...

This commit is contained in:
Ognjen Milan Robovic 2024-06-09 13:30:05 -04:00
parent d3931aeae4
commit 3f5351fce6
5 changed files with 24 additions and 9 deletions

View File

@ -246,8 +246,8 @@ package body core is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
function center_x (object : in integer) return integer is begin return (window_width - object) / 2; end center_x; function center_x (width : in integer) return integer is begin return (window_width - width) / 2; end center_x;
function center_y (object : in integer) return integer is begin return (window_height - object) / 2; end center_y; function center_y (height : in integer) return integer is begin return (window_height - height) / 2; end center_y;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------

View File

@ -155,8 +155,8 @@ package core is
function window_width return integer; function window_width return integer;
function window_height return integer; function window_height return integer;
function center_x (object : in integer) return integer; function center_x (width : in integer) return integer;
function center_y (object : in integer) return integer; function center_y (height : in integer) return integer;
function cursor_inside (x, y, width, height : in integer) return boolean; function cursor_inside (x, y, width, height : in integer) return boolean;

View File

@ -332,6 +332,11 @@ begin
for index in faction.enumeration loop for index in faction.enumeration loop
unit.base (index) := core.import_sprite (core.folder & "/game/unit/" & core.lowercase (faction.enumeration'image (index)) & "/base.png", 4, 6); unit.base (index) := core.import_sprite (core.folder & "/game/unit/" & core.lowercase (faction.enumeration'image (index)) & "/base.png", 4, 6);
end loop; end loop;
--
for index in unit.enumeration loop
unit.icon (index) := core.import_sprite (core.folder & "/icon/unit/" & core.lowercase (unit.enumeration'image (index)) & ".png", 1, 1);
unit.view (index) := core.import_sprite (core.folder & "/view/unit/" & core.lowercase (unit.enumeration'image (index)) & ".png", 1, 1);
end loop;
core.echo (core.comment, "Configuring" & deity.count'image & " deity components..."); core.echo (core.comment, "Configuring" & deity.count'image & " deity components...");
-- --
@ -339,7 +344,7 @@ begin
deity.sprite (index) := core.import_sprite (core.folder & "/game/deity/" & deity.enumeration'image (index) & ".png", 4, 1); deity.sprite (index) := core.import_sprite (core.folder & "/game/deity/" & deity.enumeration'image (index) & ".png", 4, 1);
end loop; end loop;
core.echo (core.comment, "Configuring" & construction.count'image & "construction components..."); core.echo (core.comment, "Configuring" & construction.count'image & " construction components...");
-- --
for index in construction.enumeration loop for index in construction.enumeration loop
declare folder : constant string := core.lowercase (faction.enumeration'image (construction.description (index).kind)); declare folder : constant string := core.lowercase (faction.enumeration'image (construction.description (index).kind));
@ -350,7 +355,7 @@ begin
end; end;
end loop; end loop;
core.echo (core.comment, "Configuring" & chad.count'image & "chad components..."); core.echo (core.comment, "Configuring" & chad.count'image & " chad components...");
-- --
for index in chad.enumeration loop for index in chad.enumeration loop
chad.sprite (index) := core.import_sprite (core.folder & "/game/chad/" & core.lowercase (chad.enumeration'image (index)) & ".png", 4, 6); chad.sprite (index) := core.import_sprite (core.folder & "/game/chad/" & core.lowercase (chad.enumeration'image (index)) & ".png", 4, 6);

View File

@ -119,9 +119,12 @@ package unit is
equipment.mithril_greaves, equipment.none, equipment.mithril_mace, equipment.mithril_shield)) equipment.mithril_greaves, equipment.none, equipment.mithril_mace, equipment.mithril_shield))
); );
view_width : constant integer := 64;
view_height : constant integer := 96;
base : array (faction.enumeration) of core.sprite; base : array (faction.enumeration) of core.sprite;
--~icon : array (faction.fairy .. faction.imp) of core.sprite; icon : array (enumeration) of core.sprite;
--~view : array (faction.fairy .. faction.imp) of core.sprite; view : array (enumeration) of core.sprite;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -1043,8 +1043,15 @@ package body world is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure show_unit is procedure show_unit is
offset : constant integer := 8;
width : constant integer := 600;
height : constant integer := 600;
at_x : integer := core.center_x (width) + offset;
at_y : integer := core.center_y (height) + offset;
begin begin
ui.draw_text ("Heyo world", 600, 600, 0, 0); ui.draw_frame (core.center_x (width), core.center_y (height), width, height);
--
ui.draw_sprite (unit.view (show_unit_data), unit.description (show_unit_data).name.all, at_x, at_y, 0);
end show_unit; end show_unit;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------