Added might menus, icons and views...
This commit is contained in:
parent
ec7d3c9c74
commit
c3b8831f7a
@ -104,6 +104,8 @@ begin
|
||||
unit.menu (300, 500, true);
|
||||
--
|
||||
unit.stat (unit.griffin, 0, 0, true);
|
||||
--
|
||||
might.menu (0, 0, true);
|
||||
end loop gameplay;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1,4 +1,4 @@
|
||||
with core, effect, might;
|
||||
with core, ui, effect, might;
|
||||
|
||||
use might;
|
||||
|
||||
@ -10,7 +10,11 @@ package body might is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
icon : sprite_array;
|
||||
view_width : constant integer := 90;
|
||||
view_height : constant integer := 90;
|
||||
|
||||
view_sprite : sprite_array;
|
||||
icon_sprite : sprite_array;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
@ -24,17 +28,51 @@ package body might is
|
||||
folder : constant string := core.lowercase (school'image (trait (index).kind));
|
||||
file : constant string := core.lowercase (codex'image (index));
|
||||
begin
|
||||
icon (index) := core.load_sprite ("./sprite/might/" & folder & "/" & file & ".png", 1, 1);
|
||||
view_sprite (index) := core.load_sprite ("./sprite/might/" & folder & "/" & file & ".png", 1, 1);
|
||||
icon_sprite (index) := core.load_sprite ("./sprite/might/icon/" & file & ".png", 1, 1);
|
||||
end;
|
||||
end loop;
|
||||
end configure;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw (value : in codex; x, y : in integer) is
|
||||
procedure icon (index : in codex; x, y : in integer) is
|
||||
begin
|
||||
core.draw (icon (value), x, y);
|
||||
end draw;
|
||||
core.draw (icon_sprite (index), x + 2, y + 2);
|
||||
ui.draw_overicon (x, y);
|
||||
end icon;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure view (index : in codex; x, y : in integer) is
|
||||
offset : constant integer := 4;
|
||||
begin
|
||||
core.draw (view_sprite (index), x + offset, y + offset);
|
||||
ui.draw_icon_menu (x, y, view_width + 2 * offset, view_height + 2 * offset);
|
||||
end view;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure menu (x, y : in integer; center : in boolean) is
|
||||
offset : constant integer := 16;
|
||||
width : constant integer := 168 * 8 + 2 * offset;
|
||||
height : constant integer := 12 * core.icon + 2 * offset;
|
||||
move_x : constant integer := (if center then (core.window_width - width) / 2 else x);
|
||||
move_y : constant integer := (if center then (core.window_height - height) / 2 else y);
|
||||
--
|
||||
next : array (0 .. 7) of integer := (others => 0);
|
||||
begin
|
||||
ui.draw_tiny_menu (move_x, move_y, width, height, true);
|
||||
ui.draw_title_bar (move_x, move_y, width, "Might Abilities");
|
||||
--
|
||||
for index in codex
|
||||
loop
|
||||
icon (index, move_x + offset + school'pos (trait (index).kind) * 168, move_y + offset + next (school'pos (trait (index).kind)) * core.icon);
|
||||
core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon);
|
||||
--
|
||||
next (school'pos (trait (index).kind)) := next (school'pos (trait (index).kind)) + 1;
|
||||
end loop;
|
||||
end menu;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -119,7 +119,10 @@ package might is
|
||||
|
||||
procedure configure;
|
||||
|
||||
procedure draw (value : in codex; x, y : in integer);
|
||||
procedure icon (index : in codex; x, y : in integer);
|
||||
procedure view (index : in codex; x, y : in integer);
|
||||
|
||||
procedure menu (x, y : in integer; center : in boolean);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -28,8 +28,8 @@ package body unit is
|
||||
file : constant string := core.lowercase (codex'image (index));
|
||||
begin
|
||||
sprite (index) := core.load_sprite ("./sprite/unit/" & folder & "/" & file & ".png", 6, 6);
|
||||
icon_sprite (index) := core.load_sprite ("./sprite/unit/icon/" & file & ".png", 1, 1);
|
||||
view_sprite (index) := core.load_sprite ("./sprite/unit/view/" & file & ".png", 1, 1);
|
||||
icon_sprite (index) := core.load_sprite ("./sprite/unit/icon/" & file & ".png", 1, 1);
|
||||
view_sprite (index) := core.load_sprite ("./sprite/unit/view/" & file & ".png", 1, 1);
|
||||
end;
|
||||
end loop;
|
||||
end configure;
|
||||
@ -63,17 +63,20 @@ package body unit is
|
||||
procedure menu (x, y : in integer; center : in boolean) is
|
||||
offset : constant integer := 16;
|
||||
width : constant integer := 168 * faction.count + 2 * offset;
|
||||
height : constant integer := 14 * core.icon + 2 * offset;
|
||||
height : constant integer := 14 * core.icon + 2 * offset;
|
||||
move_x : constant integer := (if center then (core.window_width - width) / 2 else x);
|
||||
move_y : constant integer := (if center then (core.window_height - height) / 2 else y);
|
||||
move : integer := 0;
|
||||
begin
|
||||
ui.draw_tiny_menu (move_x, move_y, width, height, true);
|
||||
ui.draw_title_bar (move_x, move_y, width, "Units");
|
||||
--
|
||||
for index in codex
|
||||
loop
|
||||
icon (index, move_x + offset + faction.codex'pos (trait (index).kind) * 168, move_y + offset + (codex'pos (index) mod 14) * core.icon);
|
||||
core.write (trait (index).name, move_x + offset + faction.codex'pos (trait (index).kind) * 168 + core.icon, move_y + offset + (codex'pos (index) mod 14) * core.icon);
|
||||
move := faction.codex'pos (trait (index).kind) * 168;
|
||||
--
|
||||
icon (index, move_x + offset + move, move_y + offset + (codex'pos (index) mod 14) * core.icon);
|
||||
core.write (trait (index).name, move_x + offset + move + core.icon, move_y + offset + (codex'pos (index) mod 14) * core.icon);
|
||||
end loop;
|
||||
end menu;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user