116 lines
4.9 KiB
Ada
116 lines
4.9 KiB
Ada
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
|
--
|
|
-- GNU General Public Licence (version 3 or later)
|
|
|
|
with core, ui, attribute, skill, resource, faction, equipment;
|
|
|
|
package body chad is
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
view_width : constant integer := 64;
|
|
view_height : constant integer := 96;
|
|
|
|
sprite : array (enumeration) of core.sprite;
|
|
view_sprite : array (enumeration) of core.sprite;
|
|
|
|
pepe_the_frog : core.sprite;
|
|
alice_the_mad : core.sprite;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure configure is
|
|
begin
|
|
core.echo (core.comment, "Configuring chad components...");
|
|
--
|
|
pepe_the_frog := core.import_sprite ("./sprite/unit/pepe_the_frog.png", 4, 6);
|
|
alice_the_mad := core.import_sprite ("./sprite/unit/alice_the_mad.png", 4, 6);
|
|
--
|
|
for index in enumeration loop
|
|
sprite (index) := core.import_sprite ("./sprite/chad/" & core.lowercase (enumeration'image (index)) & ".png", 4, 6);
|
|
view_sprite (index) := core.import_sprite ("./sprite/chad/view/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
|
null;
|
|
end loop;
|
|
end configure;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure draw (player : in data; x, y : in integer) is
|
|
begin
|
|
core.draw (sprite (player.index), x, y, state => player.state);
|
|
--
|
|
for index in equipment.slot loop
|
|
if player.equipments (index).show then
|
|
equipment.draw (player.equipments (index).data, player.state, x, y);
|
|
end if;
|
|
end loop;
|
|
end draw;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure view (player : in data; x, y : in integer) is
|
|
begin
|
|
ui.draw_sprite (view_sprite (player.index), trait (player.index).name, x, y, 0);
|
|
end view;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure draw_data (player : in data; x, y : in integer) is
|
|
offset : constant integer := 8;
|
|
begin
|
|
ui.draw_frame ("--", x, y, 360 + 2 * offset, 96 + 2 * offset);
|
|
--
|
|
view (player, x + offset, y + offset);
|
|
--
|
|
ui.draw_tiny_fill_bar (x + view_width + 2 * offset, y + 1 * core.icon + offset, 4 * core.icon, float (player.health.value) / float (player.health.limit));
|
|
ui.draw_tiny_fill_bar (x + view_width + 2 * offset, y + 2 * core.icon + offset, 4 * core.icon, float (player.mana.value) / float (player.mana.limit));
|
|
ui.draw_tiny_fill_bar (x + view_width + 2 * offset, y + 3 * core.icon + offset, 4 * core.icon, float (player.stamina.value) / float (player.stamina.limit));
|
|
--
|
|
ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image,
|
|
x => x + view_width + 4 * core.icon + 3 * offset,
|
|
y => y + 2 * offset,
|
|
tint => (255, 127, 127, 255),
|
|
size => 15,
|
|
code => true);
|
|
ui.write (text => "Mana " & player.mana.value'image & " /" & player.mana.limit'image,
|
|
x => x + view_width + 4 * core.icon + 3 * offset,
|
|
y => y + core.icon + 2 * offset,
|
|
tint => (127, 127, 255, 255),
|
|
size => 15,
|
|
code => true);
|
|
ui.write (text => "Stamina" & player.stamina.value'image & " /" & player.stamina.limit'image,
|
|
x => x + view_width + 4 * core.icon + 3 * offset,
|
|
y => y + 2 * core.icon + 2 * offset,
|
|
tint => (127, 255, 127, 255),
|
|
size => 15,
|
|
code => true);
|
|
--
|
|
--~attribute.draw_points (player.attributes, x, y, true);
|
|
--~skill.draw_points (player.skills, x + core.icon * 3, y, true);
|
|
end draw_data;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure draw_menu (player : in data; x, y : in integer) is
|
|
begin
|
|
null;
|
|
end draw_menu;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure draw_pepe is
|
|
begin
|
|
core.draw (pepe_the_frog, (core.window_width - core.base) / 2, (core.window_height - core.base) / 2);
|
|
end draw_pepe;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure draw_alice is
|
|
begin
|
|
core.draw (alice_the_mad, (core.window_width - core.base) / 2, (core.window_height - core.base) / 2);
|
|
end draw_alice;
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
end chad;
|