Tested out tinted tiny fill bars, works, uploading other sprites soon...

This commit is contained in:
Ognjen Milan Robovic 2024-05-19 05:18:19 -04:00
parent 6c349c045c
commit 38ff1739ae
5 changed files with 28 additions and 9 deletions

View File

@ -53,9 +53,9 @@ package body chad is
-- --
ui.draw_sprite (view (player.index), trait (player.index).name, x + offset, y + offset, 0); ui.draw_sprite (view (player.index), trait (player.index).name, x + offset, y + offset, 0);
-- --
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 + 1 * core.icon + offset, 4 * core.icon, float (player.health.value) / float (player.health.limit), (255, 0, 0, 255));
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 + 2 * core.icon + offset, 4 * core.icon, float (player.mana.value) / float (player.mana.limit), (0, 0, 255, 255));
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.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), (0, 255, 0, 255));
-- --
ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image, ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image,
x => x + view_width + 4 * core.icon + 3 * offset, x => x + view_width + 4 * core.icon + 3 * offset,

View File

@ -467,15 +467,34 @@ package body ui is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw_tiny_fill_bar (x, y, width : in integer; fill : in float) is procedure draw_tiny_fill_bar (x, y, width : in integer; fill : in float; tint : in core.colour) is
middle_width : constant integer := width - sprite (active, tiny_fill_bar_left).width - sprite (active, tiny_fill_bar_right).width; middle_width : constant integer := width - sprite (active, tiny_fill_bar_left).width - sprite (active, tiny_fill_bar_right).width;
fill_width : constant integer := integer (float (middle_width) * fill); fill_width : constant integer := integer (float (middle_width) * fill);
crop_width : constant integer := sprite (active, tiny_fill_horizontal).width;
crop_height : constant integer := sprite (active, tiny_fill_horizontal).height;
begin begin
draw (tiny_fill_bar_left, x, y - sprite (active, tiny_fill_bar_left).height); draw (tiny_fill_bar_left, x, y - crop_height);
draw (tiny_fill_bar_right, x + middle_width + sprite (active, tiny_fill_bar_left).width, y - sprite (active, tiny_fill_bar_right).height); draw (tiny_fill_bar_right, x + middle_width + crop_width, y - crop_height);
-- --
draw_horizontally (tiny_fill_bar_horizontal, x + sprite (active, tiny_fill_bar_left).width, y - sprite (active, tiny_fill_bar_horizontal).height, middle_width); draw_horizontally (tiny_fill_bar_horizontal, x + sprite (active, tiny_fill_bar_left).width, y - crop_height, middle_width);
draw_horizontally (tiny_fill_horizontal, x + sprite (active, tiny_fill_bar_left).width, y - sprite (active, tiny_fill_bar_horizontal).height, fill_width); --
for move in 0 .. fill_width / crop_width - 1 loop
core.draw (data => sprite (active, tiny_fill_horizontal),
x => x + crop_width + move * crop_width,
y => y - crop_height,
tint => tint,
factor => 1);
end loop;
--
if width mod crop_width > 0 then
core.draw (data => sprite (active, tiny_fill_horizontal),
x => x + crop_width + (fill_width / crop_width) * crop_width,
y => y - crop_height,
width => fill_width mod crop_width,
height => crop_height,
tint => tint,
factor => 1);
end if;
end draw_tiny_fill_bar; end draw_tiny_fill_bar;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------

View File

@ -74,7 +74,7 @@ package ui is
procedure draw_title_bar (x, y, width : in integer; title : in string); procedure draw_title_bar (x, y, width : in integer; title : in string);
procedure draw_fill_bar (x, y, width : in integer; fill : in float); procedure draw_fill_bar (x, y, width : in integer; fill : in float);
procedure draw_tiny_fill_bar (x, y, width : in integer; fill : in float); procedure draw_tiny_fill_bar (x, y, width : in integer; fill : in float; tint : in core.colour);
procedure draw_scroll_bar (x, y, height : in integer; offset : in integer); procedure draw_scroll_bar (x, y, height : in integer; offset : in integer);
procedure draw_menu (x, y, width, height : in integer); procedure draw_menu (x, y, width, height : in integer);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 137 B