From 907f117f417c9576690ad62cb00a553ca4b74097 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 19 May 2024 05:42:45 -0400 Subject: [PATCH] Revised few Core functions to use tint, and blanked tiny fill bars... --- source/core.adb | 12 +++++------ source/core.ads | 4 ++-- source/main.adb | 8 +++---- source/ui.adb | 38 +++++++++++----------------------- ui/dwarf/tiny_fill_bar_horizontal.png | Bin 162 -> 166 bytes ui/fairy/tiny_fill_horizontal.png | Bin 157 -> 160 bytes ui/gnoll/tiny_fill_horizontal.png | Bin 139 -> 140 bytes ui/goblin/tiny_fill_horizontal.png | Bin 157 -> 156 bytes ui/imp/tiny_fill_horizontal.png | Bin 143 -> 138 bytes ui/kobold/tiny_fill_horizontal.png | Bin 176 -> 170 bytes 10 files changed, 24 insertions(+), 38 deletions(-) diff --git a/source/core.adb b/source/core.adb index 69e46d3..936f52d 100644 --- a/source/core.adb +++ b/source/core.adb @@ -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; diff --git a/source/core.ads b/source/core.ads index eaa35b9..47ae594 100644 --- a/source/core.ads +++ b/source/core.ads @@ -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; diff --git a/source/main.adb b/source/main.adb index a54371e..ee80e89 100644 --- a/source/main.adb +++ b/source/main.adb @@ -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; -- diff --git a/source/ui.adb b/source/ui.adb index cbdf4a1..f2700c7 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -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; ------------------------------------------------------------------------------------------ diff --git a/ui/dwarf/tiny_fill_bar_horizontal.png b/ui/dwarf/tiny_fill_bar_horizontal.png index f64468512a8e4e24d4e1a5705708d0caeb7bb829..a8722210635db97f8ffafb63d1090c718b22df1e 100644 GIT binary patch delta 116 zcmV-)0E_>k0j2?vIc-=;L_t(o!|m2h4Zu(c1K_?NCAClsXhFx6Vr7%j!`e%)Uq~PT z$=|a`zD~gHZtDc@%miQs97&HP0Dz-cRav)SyYD~%0R#|002=^E!qs`n@)6kqN%8?) WswdrP%THYZ0000U*quhrt!NdqN zv)`@E9A$w6K)S$IpFqFBE1=3vG5~}sS9g!Hgnogl(*6OGpZ@{%0%m4*0UCm(+avTO Q{Qv*}07*qoM6N<$f?Po_z5oCK delta 107 zcmV-x0F?ir0i6MmIb=^sL_t(o!|l{D5x_7E#ZV_T=(S|vZ>8Eoh2;usQf`0b@YUIqgW=D=+WSblamIq4cm{=H$#I(?ZSLqgfE>bZ=O uq4!u-BE@&S;}>vXU}Sl6=8r4`LmB@pd!EM1dz&g5fWXt$&t;ucLK6VA%pa5h delta 89 zcmeBS>}H%`8D#6};usQf`0b@YUIqgW=8JiboSy_+S#%5}|K6}=oxV(nVa8mowZ;lY tXSvT*i0^pEFW|ty$l~(-IU_^DcZL#vPVV)FSrZt5z|+;wWt~$(698eV9ijjL diff --git a/ui/goblin/tiny_fill_horizontal.png b/ui/goblin/tiny_fill_horizontal.png index 2899d8abf14e9f3cdb71900a2b7d3681e0750d2f..8761bff694c1fb47dc2bbc2701ad1989ea5b6b77 100644 GIT binary patch delta 106 zcmV-w0G0op0h|GlIb%*qL_t(o!|l|u4ZuJML(zXIlXzODWCT`7s?6Zx{2G^7LI4pF zw>!K0Itx5ALkc(*fFxX5l9(A>S-+E}1d08mL+29>ZjT^XInsbnzk<~RKJuz)1#R3GtRO&Wo{&tm`p N002ovPDHLkV1mSYF4_P9 diff --git a/ui/imp/tiny_fill_horizontal.png b/ui/imp/tiny_fill_horizontal.png index 541e3cf1677de30b73e836893df9ab76dbced351..1d269a30608d7a5184362646c8f7709b9d8a5efd 100644 GIT binary patch delta 88 zcmV-e0H^}Q-{8RqEe;usQfI5|Orb#a17PsxEB4-b8)SCBpMXpzYV#RH2}EDrGP_+Hl_ wyW#o03^$OXEgEvVUGCkF0u8v_4sx(FB);R``GooFO$H$FboFyt=akR{05+T^IRF3v diff --git a/ui/kobold/tiny_fill_horizontal.png b/ui/kobold/tiny_fill_horizontal.png index 6c0761d06c58fcfa13cc987a3f16496445158aad..e2e8b918ac834fb887e43635663c43bd6ae3c871 100644 GIT binary patch delta 120 zcmV-;0Ehpu0jdFzIdNP`L_t(o!|jzp5x_tQ1H(;~APz031ubYm0v6g=HRM6|lW%4j z01!fK$0Fio7B~Rl?qH?edzTx?%;g5EifX`ShCc!(Pj^!boWB4o`D;iwKtIKF1MGJ! agb*J$6RB&j+IoEe0000