More rafactoring, done for today probably...

This commit is contained in:
Ognjen Milan Robovic 2024-06-14 15:08:44 -04:00
parent b2b79513b3
commit 48faba3fe0
4 changed files with 55 additions and 23 deletions

View File

@ -241,7 +241,7 @@ begin
world.insert_chad (player); world.insert_chad (player);
world.insert_chad (opponent); world.insert_chad (opponent);
--~world.load ("heyo"); world.load ("heyo");
ui.active := ui.style'val (faction.enumeration'pos (chad.description (player.index).kind) + 1); ui.active := ui.style'val (faction.enumeration'pos (chad.description (player.index).kind) + 1);
@ -293,18 +293,6 @@ begin
(map_frame_width - 5 * core.icon * resource.count) / 2 + (5 * core.icon) * resource.enumeration'pos (index) + core.icon, core.base, 4 * core.icon, core.icon, 10); (map_frame_width - 5 * core.icon * resource.count) / 2 + (5 * core.icon) * resource.enumeration'pos (index) + core.icon, core.base, 4 * core.icon, core.icon, 10);
end loop; end loop;
-- --
--~declare move_x : integer := (map_frame_width - core.icon * material.count) / 2;
--~begin
--~for index in material.enumeration loop
--~if world.map.chads (1).materials (index).value > 0 then
--~ui.draw_icon (material.icon (index), material.description (index).name.all, move_x, core.base + core.icon);
--~ui.draw_text (world.map.chads (1).materials (index).value'image, move_x, core.base + 2 * core.icon, core.icon, core.icon, 10);
--~--
--~move_x := move_x + core.icon;
--~end if;
--~end loop;
--~end;
--
signal_list (core.signal_mode).all; signal_list (core.signal_mode).all;
-- --
core.camera.x := world.map.chads (1).x; core.camera.x := world.map.chads (1).x;

View File

@ -194,8 +194,6 @@ package body ui is
if core.cursor_inside (x, y, core.icon, core.icon) then if core.cursor_inside (x, y, core.icon, core.icon) then
prioritize := true; prioritize := true;
-- --
draw (icon_selected, x, y);
--
core.write_help_box (text); core.write_help_box (text);
-- --
if core.cursor_mode = core.cursor_left then if core.cursor_mode = core.cursor_left then
@ -207,6 +205,26 @@ package body ui is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw_text_in_overicon (text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access) is
begin
draw (overicon, x, y);
--
write (text, x - 2, y + (core.icon - monoheight) / 2, code => true);
--
if core.cursor_inside (x, y, core.icon, core.icon) then
prioritize := true;
--
core.write_help_box (text);
--
if core.cursor_mode = core.cursor_left then
action.all;
core.cursor_mode := core.cursor_none;
end if;
end if;
end draw_text_in_overicon;
------------------------------------------------------------------------------------------
procedure draw_sprite (data : in core.sprite; text : in string; x, y, offset : in integer; action : core.pointer := core.idle_skip'access) is procedure draw_sprite (data : in core.sprite; text : in string; x, y, offset : in integer; action : core.pointer := core.idle_skip'access) is
begin begin
core.draw (data, x + offset, y + offset, factor => 1); core.draw (data, x + offset, y + offset, factor => 1);

View File

@ -41,9 +41,10 @@ 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_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_text_in_overicon ( 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

@ -1151,7 +1151,8 @@ package body world is
-- --
for index in attribute.enumeration loop for index in attribute.enumeration loop
ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, x + chad.view_width + skip, y + core.icon); ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, x + chad.view_width + skip, y + core.icon);
ui.draw_text (data.attributes (index).value'image, x + chad.view_width + skip, y + 2 * core.icon, core.icon, core.icon, core.more); --~ui.draw_text (data.attributes (index).value'image, x + chad.view_width + skip, y + 2 * core.icon, core.icon, core.icon, core.more);
ui.draw_text_in_overicon (data.attributes (index).value'image, x + chad.view_width + skip, y + 2 * core.icon);
-- --
skip := skip + core.icon; skip := skip + core.icon;
end loop; end loop;
@ -1217,6 +1218,11 @@ package body world is
text => material.description (data.materials (8 * index_y + index_x).index).name.all, text => material.description (data.materials (8 * index_y + index_x).index).name.all,
x => x + index_x * core.icon, x => x + index_x * core.icon,
y => y + index_y * core.icon); y => y + index_y * core.icon);
--
ui.write (text => (if data.materials (8 * index_y + index_x).value > 0 then data.materials (8 * index_y + index_x).value'image else ""),
x => x + index_x * core.icon + (if data.materials (8 * index_y + index_x).value < 10 then 14 else 5),
y => y + index_y * core.icon + 17,
code => true);
end loop; end loop;
end loop; end loop;
-- --
@ -1263,11 +1269,12 @@ package body world is
declare player : chad.information renames world.map.chads (1); declare player : chad.information renames world.map.chads (1);
-- --
data : effect.information := location.description (map.locations (index).index).evoke; data : effect.information := location.description (map.locations (index).index).evoke;
done : boolean := false;
-- --
attribute_index : attribute.enumeration; attribute_index : attribute.enumeration;
--~skill_index : skill.enumeration; --~skill_index : skill.enumeration;
resource_index : resource.enumeration; resource_index : resource.enumeration;
--~material_index : material.enumeration; material_index : material.enumeration;
begin begin
case data.kind is case data.kind is
when effect.idle => null; when effect.idle => null;
@ -1287,9 +1294,27 @@ package body world is
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " " ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
& resource.description (resource_index).name.all & " resource points."); & resource.description (resource_index).name.all & " resource points.");
-- --
--~when effect.modify_material => material_index := material.enumeration'val (data.modifier); when effect.modify_material => material_index := material.enumeration'val (data.modifier);
--~player.materials (material_index) := player.materials (material_index) + data.amount; --
--~ui.echo ("+" & data.amount'image & " " & material.description (material_index).name.all); for this in material.limit loop
exit when done;
if material.enumeration'pos (player.materials (this).index) = material.enumeration'pos (material_index) then
player.materials (this).value := player.materials (this).value + data.amount;
done := true;
end if;
end loop;
--
if not done then
for this in material.limit loop
if material.enumeration'pos (player.materials (this).index) = material.enumeration'pos (material.none) then
player.materials (this).index := material_index;
player.materials (this).value := data.amount;
exit;
end if;
end loop;
end if;
--
ui.echo ("+" & data.amount'image & " " & material.description (material_index).name.all);
when others => null; when others => null;
end case; end case;
end; end;