Saving changes before major refactoring...

This commit is contained in:
Ognjen Milan Robovic 2024-06-09 16:53:27 -04:00
parent 52313927d1
commit 83373bbda1
6 changed files with 54 additions and 22 deletions

View File

@ -57,6 +57,7 @@ package equipment is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
count : constant natural := enumeration'pos (enumeration'last) + 1; count : constant natural := enumeration'pos (enumeration'last) + 1;
error : constant natural := enumeration'pos (none);
default : constant equip_array := (others => none); default : constant equip_array := (others => none);

View File

@ -233,7 +233,7 @@ procedure main is
at_y := at_y + core.base; at_y := at_y + core.base;
-- --
for index in 0 .. unit.limit - 1 loop for index in 0 .. unit.limit - 1 loop
world.draw_unit (player_1.units (index).index, core.walk, at_x + index * core.icon + 8, at_y + 8); world.draw_unit (player_1.units (index).index, core.walk, at_x + index * core.icon + 8, at_y + 8, 1);
world.show_unit_data := player_1.units (index).index; world.show_unit_data := player_1.units (index).index;
ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, unit.description (player_1.units (index).index).name.all, world.show_unit'access); ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, unit.description (player_1.units (index).index).name.all, world.show_unit'access);
end loop; end loop;

View File

@ -181,6 +181,25 @@ package body ui is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw_icon_and_text (data : in core.sprite; text : in string; x, y, width : in integer; action : core.pointer := core.idle_skip'access) is
begin
draw_icon_menu (x, y, width, core.icon);
--
core.draw (data, x, y, factor => 1);
write (text, x + core.icon + 10, y + 10, code => true);
--
if core.cursor_inside (x, y, core.icon / core.zoom, core.icon / core.zoom) then
prioritize := true;
--
if core.cursor_mode = core.cursor_left then
action.all;
core.cursor_mode := core.cursor_none;
end if;
end if;
end draw_icon_and_text;
------------------------------------------------------------------------------------------
procedure draw_overicon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access) is procedure draw_overicon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access) is
begin begin
core.draw (data, x, y, factor => 1); core.draw (data, x, y, factor => 1);

View File

@ -37,6 +37,7 @@ package ui is
procedure draw_separator (x, y, width : in integer); procedure draw_separator (x, y, width : in integer);
procedure draw_icon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access); procedure draw_icon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access);
procedure draw_icon_and_text (data : in core.sprite; text : in string; x, y, width : in integer; action : core.pointer := core.idle_skip'access);
procedure draw_overicon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access); procedure draw_overicon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access);
procedure draw_sprite (data : in core.sprite; text : in string; x, y, offset : in integer; action : core.pointer := core.idle_skip'access); procedure draw_sprite (data : in core.sprite; text : in string; x, y, offset : in integer; action : core.pointer := core.idle_skip'access);

View File

@ -123,6 +123,13 @@ package body world is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
function equipment_valid (data : in equipment.enumeration) return boolean is
begin
return equipment.enumeration'pos (data) /= equipment.error;
end equipment_valid;
------------------------------------------------------------------------------------------
procedure make (index : in biome; width, height, chad_limit : in natural) is procedure make (index : in biome; width, height, chad_limit : in natural) is
begin begin
core.echo (core.comment, "-- Procedurally generating new map..."); core.echo (core.comment, "-- Procedurally generating new map...");
@ -1031,12 +1038,12 @@ package body world is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw_unit (data : in unit.enumeration; state : in core.animation; x, y : in integer) is procedure draw_unit (data : in unit.enumeration; state : in core.animation; x, y, factor : in integer) is
begin begin
core.draw (unit.base (unit.description (data).kind), x, y, state => state); core.draw (unit.base (unit.description (data).kind), x, y, state => state, factor => factor);
-- --
for kind in equipment.kind loop for kind in equipment.kind loop
core.draw (equipment.sprite (unit.description (data).equipments (kind)), x, y, state => state); core.draw (equipment.sprite (unit.description (data).equipments (kind)), x, y, state => state, factor => factor);
end loop; end loop;
end draw_unit; end draw_unit;
@ -1068,9 +1075,7 @@ package body world is
at_x := core.center_x (width) + offset + unit.view_width; at_x := core.center_x (width) + offset + unit.view_width;
end if; end if;
-- --
ui.draw_icon_menu (at_x, at_y, core.icon * 3, core.icon, attribute.description (index).text.all); ui.draw_icon_and_text (attribute.icon (index), data.attributes (index)'image, at_x, at_y, 3 * core.icon);
core.draw (attribute.icon (index), at_x, at_y, factor => 1);
ui.write (data.attributes (index)'image, at_x + core.icon + more, at_y + more, code => true);
-- --
at_x := at_x + 3 * core.icon; at_x := at_x + 3 * core.icon;
end loop; end loop;
@ -1103,14 +1108,19 @@ package body world is
at_x := core.center_x (width) + offset; at_x := core.center_x (width) + offset;
end if; end if;
-- --
ui.draw_icon_menu (at_x, at_y, (width - 2 * offset) / 2, core.icon, equipment.description (data.equipments (index)).name.all); ui.draw_icon_and_text (data => (if equipment_valid (data.equipments (index)) then equipment.icon (data.equipments (index)) else equipment.slot (index)),
ui.write (equipment.description (data.equipments (index)).name.all, at_x + core.icon + more, at_y + more, code => true); text => equipment.description (data.equipments (index)).name.all,
-- x => at_x,
if equipment.enumeration'pos (data.equipments (index)) /= equipment.enumeration'pos (equipment.none) then y => at_y,
core.draw (equipment.icon (data.equipments (index)), at_x, at_y, factor => 1); width => (width - 2 * offset) / 2);
else --~ui.draw_icon_menu (at_x, at_y, (width - 2 * offset) / 2, core.icon, equipment.description (data.equipments (index)).name.all);
core.draw (equipment.slot (index), at_x, at_y, factor => 1); --~ui.write (equipment.description (data.equipments (index)).name.all, at_x + core.icon + more, at_y + more, code => true);
end if; --~--
--~if equipment.enumeration'pos (data.equipments (index)) /= equipment.enumeration'pos (equipment.none) then
--~core.draw (equipment.icon (data.equipments (index)), at_x, at_y, factor => 1);
--~else
--~core.draw (equipment.slot (index), at_x, at_y, factor => 1);
--~end if;
-- --
at_x := at_x + (width - 2 * offset) / 2; at_x := at_x + (width - 2 * offset) / 2;
end loop; end loop;
@ -1130,7 +1140,8 @@ package body world is
draw_unit (data => unit.enumeration'val (map.units (index).index), draw_unit (data => unit.enumeration'val (map.units (index).index),
state => core.animation'val (map.units (index).state), state => core.animation'val (map.units (index).state),
x => offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom, x => offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom,
y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom); y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom,
factor => core.zoom);
-- --
core.increment (drawn_units); core.increment (drawn_units);
end if; end if;

View File

@ -231,7 +231,7 @@ package world is
procedure add_chad (data : in chad.information); procedure add_chad (data : in chad.information);
procedure draw_unit (data : in unit.enumeration; state : in core.animation; x, y : in integer); procedure draw_unit (data : in unit.enumeration; state : in core.animation; x, y, factor : in integer);
procedure show_unit; procedure show_unit;
procedure resource_cheat_1; procedure resource_cheat_1;