Revised few Core functions to use tint, and blanked tiny fill bars...

This commit is contained in:
Ognjen Milan Robovic 2024-05-19 05:42:45 -04:00
parent 38ff1739ae
commit 907f117f41
10 changed files with 24 additions and 38 deletions

View File

@ -305,27 +305,27 @@ package body core is
------------------------------------------------------------------------------------------
procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer) is
procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer; tint : in colour := (others => 255)) is
begin
for move in 0 .. width / data.width - 1 loop
draw (data, x + move * data.width, y, factor => 1);
draw (data, x + move * data.width, y, tint => tint, factor => 1);
end loop;
--
if width mod data.width > 0 then
draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height, factor => 1);
draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height, tint => tint, factor => 1);
end if;
end draw_horizontally;
------------------------------------------------------------------------------------------
procedure draw_vertically (data : in sprite; x, y, height, factor : in integer) is
procedure draw_vertically (data : in sprite; x, y, height, factor : in integer; tint : in colour := (others => 255)) is
begin
for move in 0 .. height / data.height - 1 loop
draw (data, x, y + move * data.height, factor => 1);
draw (data, x, y + move * data.height, tint => tint, factor => 1);
end loop;
--
if height mod data.height > 0 then
draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height, factor => 1);
draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height, tint => tint, factor => 1);
end if;
end draw_vertically;

View File

@ -159,8 +159,8 @@ package core is
factor : in integer := zoom;
tint : in colour := (others => 255));
procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer);
procedure draw_vertically (data : in sprite; x, y, height, factor : in integer);
procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer; tint : in colour := (others => 255));
procedure draw_vertically (data : in sprite; x, y, height, factor : in integer; tint : in colour := (others => 255));
procedure write (text : in string := "";
x : in integer := 0;

View File

@ -315,10 +315,10 @@ begin
end loop;
--
resource.draw_points (player.resources, (preview_width - 4 * icon * resource.count) / 2, (if view_list (map_preview_panel) then icon else 0));
--~ui.draw_fill_bar ((preview_width - 320) / 2, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 0.0);
--~ui.draw_tiny_fill_bar ((preview_width - 160) / 2, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 0.0);
--~ui.draw_fill_bar ((preview_width - 320) / 2 + 400, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 1.0);
--~ui.draw_tiny_fill_bar ((preview_width - 160) / 2 + 400, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 1.0);
ui.draw_fill_bar ((preview_width - 320) / 2, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 0.0);
ui.draw_tiny_fill_bar ((preview_width - 160) / 2, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 0.3, (255, 255, 0, 255));
ui.draw_fill_bar ((preview_width - 320) / 2 + 400, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 0.6);
ui.draw_tiny_fill_bar ((preview_width - 160) / 2 + 400, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 0.6, (255, 0, 255, 255));
--
signal_list (signal_mode).all;
--

View File

@ -89,9 +89,9 @@ package body ui is
------------------------------------------------------------------------------------------
procedure draw_horizontally (index : in element; x, y, width : in integer; action : core.pointer := core.idle_skip'access) is
procedure draw_horizontally (index : in element; x, y, width : in integer; action : core.pointer := core.idle_skip'access; tint : in core.colour := (others => 255)) is
begin
core.draw_horizontally (sprite (active, index), x, y, width, factor => 1);
core.draw_horizontally (sprite (active, index), x, y, width, 1, tint);
--
--~if core.cursor_mode = 1 and cursor_inside (x, y, width / core.zoom, sprite (active, index).height / core.zoom) then
--~action.all;
@ -101,9 +101,9 @@ package body ui is
------------------------------------------------------------------------------------------
procedure draw_vertically (index : in element; x, y, height : in integer; action : core.pointer := core.idle_skip'access) is
procedure draw_vertically (index : in element; x, y, height : in integer; action : core.pointer := core.idle_skip'access; tint : in core.colour := (others => 255)) is
begin
core.draw_vertically (sprite (active, index), x, y, height, factor => 1);
core.draw_vertically (sprite (active, index), x, y, height, 1, tint);
--
--~if core.cursor_mode = 1 and cursor_inside (x, y, sprite (active, index).width / core.zoom, height / core.zoom) then
--~action.all;
@ -470,31 +470,17 @@ package body ui 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;
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
draw (tiny_fill_bar_left, x, y - crop_height);
draw (tiny_fill_bar_right, x + middle_width + crop_width, y - crop_height);
draw (tiny_fill_bar_left, x, y - sprite (active, tiny_fill_bar_left).height);
draw (tiny_fill_bar_right, x + middle_width + sprite (active, tiny_fill_bar_left).width, y - sprite (active, tiny_fill_bar_left).height);
--
draw_horizontally (tiny_fill_bar_horizontal, x + sprite (active, tiny_fill_bar_left).width, y - crop_height, middle_width);
draw_horizontally (tiny_fill_bar_horizontal, x + sprite (active, tiny_fill_bar_left).width, y - sprite (active, tiny_fill_bar_horizontal).height, middle_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;
draw_horizontally (index => tiny_fill_horizontal,
x => x + sprite (active, tiny_fill_bar_left).width,
y => y - sprite (active, tiny_fill_bar_horizontal).height,
width => fill_width,
tint => tint);
end draw_tiny_fill_bar;
------------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 170 B