Reimplemented magics and added 3 new ones...

This commit is contained in:
Ognjen Milan Robovic 2024-05-13 15:43:06 -04:00
parent 4ede350cc2
commit 611ac28395
7 changed files with 25 additions and 16 deletions

View File

@ -8,11 +8,10 @@ package body magic is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
view_width : constant natural := 90; view_width : constant natural := 64;
view_height : constant natural := 90; view_height : constant natural := 64;
view_sprite : array (enumeration) of core.sprite; view_sprite : array (enumeration) of core.sprite;
icon_sprite : array (enumeration) of core.sprite;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@ -25,26 +24,36 @@ package body magic is
file : constant string := core.lowercase (enumeration'image (index)); file : constant string := core.lowercase (enumeration'image (index));
begin begin
view_sprite (index) := core.import_sprite ("./sprite/magic/" & folder & "/" & file & ".png", 1, 1); view_sprite (index) := core.import_sprite ("./sprite/magic/" & folder & "/" & file & ".png", 1, 1);
icon_sprite (index) := core.import_sprite ("./sprite/magic/icon/" & file & ".png", 1, 1);
end; end;
end loop; end loop;
end configure; end configure;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure icon (index : in enumeration; x, y : in integer) is procedure view (index : in enumeration; x, y : in integer) is
offset : constant integer := 8;
begin begin
ui.draw_overicon (icon_sprite (index), trait (index).text, x, y); ui.draw_frame (trait (index).text, x, y, view_width + 2 * offset, view_height + 2 * offset);
end icon; core.draw (view_sprite (index), x + offset, y + offset);
end view;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure view (index : in enumeration; x, y : in integer) is procedure menu (x, y : in integer; center : in boolean) is
offset : constant integer := 4; offset : constant integer := core.icon;
width : constant integer := count * view_width + (count + 1) * offset + offset / 2;
height : constant integer := view_height + 2 * offset + offset / 2;
begin begin
core.draw (view_sprite (index), x + offset, y + offset); ui.draw_tiny_menu (x => (if center then (core.window_width - width) / 2 else x),
ui.draw_icon_menu (trait (index).text, x, y, view_width + 2 * offset, view_height + 2 * offset); y => (if center then (core.window_height - height) / 2 else y),
end view; width => width,
height => height);
--
for index in enumeration loop
view (index, (if center then (core.window_width - width) / 2 else x) + offset + enumeration'pos (index) * (offset + view_width),
(if center then (core.window_height - height) / 2 else y) + offset);
end loop;
end menu;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -56,9 +56,10 @@ package magic is
procedure configure; procedure configure;
procedure icon (index : in enumeration; x, y : in integer);
procedure view (index : in enumeration; x, y : in integer); procedure view (index : in enumeration; x, y : in integer);
procedure menu (x, y : in integer; center : in boolean);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end magic; end magic;

View File

@ -5,7 +5,7 @@
pragma ada_2012; pragma ada_2012;
--~with core, ui, effect, attribute, skill, resource, faction, might, magic, equipment, unit, construction, chad, deity, world, ai; --~with core, ui, effect, attribute, skill, resource, faction, might, magic, equipment, unit, construction, chad, deity, world, ai;
with core, ui, effect, attribute, skill, resource, faction, material, equipment, unit, construction, chad, world; with core, ui, effect, attribute, skill, resource, faction, material, magic, equipment, unit, construction, chad, world;
with ada.strings.unbounded; with ada.strings.unbounded;
use ada.strings.unbounded; use ada.strings.unbounded;
@ -194,7 +194,7 @@ begin
skill.configure; skill.configure;
resource.configure; resource.configure;
--~might.configure; --~might.configure;
--~magic.configure; magic.configure;
material.configure; material.configure;
equipment.configure; equipment.configure;
unit.configure; unit.configure;

View File

@ -75,7 +75,6 @@ package ui is
procedure draw_menu (x, y, width, height : in integer); procedure draw_menu (x, y, width, height : in integer);
procedure draw_tiny_menu (x, y, width, height : in integer); procedure draw_tiny_menu (x, y, width, height : in integer);
procedure draw_icon_menu (x, y, width, height : in integer); procedure draw_icon_menu (x, y, width, height : in integer);
procedure draw_state_box (x, y : in integer); procedure draw_state_box (x, y : in integer);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 934 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 1.4 KiB