Added entity count, menu centering, refactoring...
This commit is contained in:
parent
603a5025fe
commit
2172a630b1
@ -25,6 +25,8 @@ package attribute is
|
||||
|
||||
icon : sprite_array;
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Attack ", 0),
|
||||
("Defense ", 0),
|
||||
|
@ -58,6 +58,8 @@ package construction is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
-- Remove me later... Lv Gr Gold Wd Mr Or Sl Cr Gm
|
||||
("Boar Glen ", faction.neutral, 1, 1, ( 90, 0, 0, 0, 0, 0, 0), 1, effect.none, menu.none),
|
||||
|
@ -211,17 +211,11 @@ package body core is
|
||||
loop
|
||||
line ((x, offset_y + horizontal * base), (width, 0));
|
||||
--
|
||||
for vertical in 0 .. width / base
|
||||
for vertical in 0 .. width / base - 1
|
||||
loop
|
||||
line ((offset_x + vertical * base - base / 2, crop_offset + 2 * base * (horizontal / 2) + base), (0, base));
|
||||
line ((offset_x + vertical * base, crop_offset + 2 * base * (horizontal / 2)), (0, base));
|
||||
end loop;
|
||||
--
|
||||
if horizontal > 1 then
|
||||
for vertical in 0 .. width / base - 1
|
||||
loop
|
||||
line ((offset_x + vertical * base, crop_offset + 2 * base * (horizontal / 2)), (0, base));
|
||||
end loop;
|
||||
end if;
|
||||
end loop;
|
||||
--
|
||||
for vertical in 0 .. width / base - 1
|
||||
|
@ -23,6 +23,8 @@ package deity is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Svarog the Lawful ", 3), -- Serbia
|
||||
("Dabog the Lonely ", -3),
|
||||
|
@ -20,6 +20,8 @@ package effect is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("- ", true),
|
||||
("- ", true)
|
||||
|
@ -23,6 +23,8 @@ package faction is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Neutral ", attribute.attack, skill.tactics, resource.gold),
|
||||
("Castle ", attribute.attack, skill.archery, resource.ore),
|
||||
|
@ -51,6 +51,8 @@ package item is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Admiral's Hat ", head, 0, effect.none),
|
||||
("Ambassador's Sash ", full_body, 0, effect.none),
|
||||
|
@ -51,6 +51,8 @@ package magic is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Magic Arrow ", neutral, 0, effect.none),
|
||||
("Chain Magic Arrow ", neutral, 0, effect.none),
|
||||
|
@ -90,8 +90,8 @@ begin
|
||||
--~construction.draw (this, 128 * (construction.codex'pos (this) mod 12) + 32, 128 * (construction.codex'pos (this) / 12) + 32);
|
||||
--~end loop;
|
||||
--
|
||||
core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--~core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--~core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--
|
||||
ui.draw_menu (0, 0, preview_width, preview_height, false);
|
||||
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height, true);
|
||||
@ -111,8 +111,9 @@ begin
|
||||
--
|
||||
core.draw_state_box (preview_width + 32, 32);
|
||||
--
|
||||
menu.draw (menu.attribute_information, 100, 100);
|
||||
menu.draw (menu.resource_information, 600, 100);
|
||||
menu.draw (menu.resource_information, 420, 100, false);
|
||||
menu.draw (menu.skill_information, 740, 100, false);
|
||||
menu.draw (menu.attribute_information, 100, 100, true);
|
||||
end loop gameplay;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -12,53 +12,56 @@ package body menu is
|
||||
trait (skill_information).title := "Skill Information ";
|
||||
trait (resource_information).title := "Resource Information ";
|
||||
--
|
||||
trait (attribute_information).elements := new element_array (0 .. attribute.codex'pos (attribute.codex'last));
|
||||
trait (skill_information).elements := new element_array (0 .. skill.codex'pos (skill.codex'last));
|
||||
trait (resource_information).elements := new element_array (0 .. resource.codex'pos (resource.codex'last));
|
||||
trait (attribute_information).elements := new element_array (0 .. attribute.count - 1);
|
||||
trait (skill_information).elements := new element_array (0 .. skill.count - 1);
|
||||
trait (resource_information).elements := new element_array (0 .. resource.count - 1);
|
||||
--
|
||||
trait (attribute_information).length := attribute.codex'pos (attribute.codex'last) + 1;
|
||||
trait (skill_information).length := skill.codex'pos (skill.codex'last) + 1;
|
||||
trait (resource_information).length := resource.codex'pos (resource.codex'last) + 1;
|
||||
trait (attribute_information).length := attribute.count;
|
||||
trait (skill_information).length := skill.count;
|
||||
trait (resource_information).length := resource.count;
|
||||
--
|
||||
for index in 0 .. attribute.codex'pos (attribute.codex'last)
|
||||
for index in attribute.codex
|
||||
loop
|
||||
trait (attribute_information).elements (index) := (button, index, attribute.trait (attribute.codex'val (index)).name, attribute.icon (attribute.codex'val (index)));
|
||||
trait (attribute_information).elements (attribute.codex'pos (index)) := (button, 0, attribute.trait (index).name, attribute.icon (index));
|
||||
end loop;
|
||||
--
|
||||
for index in 0 .. skill.codex'pos (skill.codex'last)
|
||||
for index in skill.codex
|
||||
loop
|
||||
trait (skill_information).elements (index) := (button, index, skill.trait (skill.codex'val (index)).name, skill.icon (skill.codex'val (index)));
|
||||
trait (skill_information).elements (skill.codex'pos (index)) := (button, 0, skill.trait (index).name, skill.icon (index));
|
||||
end loop;
|
||||
--
|
||||
for index in 0 .. resource.codex'pos (resource.codex'last)
|
||||
for index in resource.codex
|
||||
loop
|
||||
trait (resource_information).elements (index) := (button, index, resource.trait (resource.codex'val (index)).name, resource.icon (resource.codex'val (index)));
|
||||
trait (resource_information).elements (resource.codex'pos (index)) := (button, 0, resource.trait (index).name, resource.icon (index));
|
||||
end loop;
|
||||
end configure;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw (index : in codex; x, y : in integer) is
|
||||
procedure draw (index : in codex; x, y : in integer; center : in boolean) is
|
||||
draw_offset : constant integer := 16;
|
||||
icon_offset : constant integer := 4;
|
||||
icon_size : constant integer := 32;
|
||||
offset : constant integer := icon_size + 2 * icon_offset;
|
||||
width : constant integer := 300;
|
||||
width : constant integer := 240;
|
||||
height : constant integer := trait (index).length * offset + 2 * draw_offset;
|
||||
--
|
||||
offset_x : constant integer := (if center then (core.window_width - width) / 2 else x);
|
||||
offset_y : constant integer := (if center then (core.window_height - height) / 2 else y);
|
||||
begin
|
||||
if index = none then
|
||||
return;
|
||||
end if;
|
||||
--
|
||||
ui.draw_title_bar (x, y, width, trait (index).title);
|
||||
ui.draw_tiny_menu (x, y, width, height, true);
|
||||
ui.draw_title_bar (offset_x, offset_y, width, trait (index).title);
|
||||
ui.draw_tiny_menu (offset_x, offset_y, width, height, true);
|
||||
--
|
||||
for element_index in 0 .. trait (index).length - 1
|
||||
loop
|
||||
ui.draw_frame (x + draw_offset, y + draw_offset + element_index * offset, offset, offset);
|
||||
ui.draw_frame (offset_x + draw_offset, offset_y + draw_offset + element_index * offset, offset, offset);
|
||||
--
|
||||
core.draw (trait (index).elements (element_index).icon, x + draw_offset + icon_offset, y + draw_offset + icon_offset + element_index * offset);
|
||||
core.write (trait (index).elements (element_index).text, x + draw_offset + icon_offset + offset, y + draw_offset + icon_offset + element_index * offset);
|
||||
core.draw (trait (index).elements (element_index).icon, offset_x + draw_offset + icon_offset, offset_y + draw_offset + icon_offset + element_index * offset);
|
||||
core.write (trait (index).elements (element_index).text, offset_x + draw_offset + icon_offset + offset, offset_y + draw_offset + icon_offset + element_index * offset);
|
||||
end loop;
|
||||
end draw;
|
||||
|
||||
|
@ -41,7 +41,7 @@ package menu is
|
||||
|
||||
procedure configure;
|
||||
|
||||
procedure draw (index : in codex; x, y : in integer);
|
||||
procedure draw (index : in codex; x, y : in integer; center : in boolean);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -50,6 +50,8 @@ package might is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Cover ", archery, 0, effect.none),
|
||||
("Evasive Maneuvers ", archery, 0, effect.none),
|
||||
|
@ -28,6 +28,8 @@ package resource is
|
||||
|
||||
icon : sprite_array;
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Gold ", 1),
|
||||
("Wood ", 3),
|
||||
|
@ -31,6 +31,8 @@ package skill is
|
||||
|
||||
icon : sprite_array;
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Archery ", 0, 0),
|
||||
("Offense ", 0, 0),
|
||||
|
@ -72,6 +72,8 @@ package unit is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
("Azure Dragon ", faction.neutral, 1, 2, 1, 9, effect.none),
|
||||
("Boar ", faction.neutral, 1, 2, 1, 9, effect.none),
|
||||
|
Loading…
Reference in New Issue
Block a user