Added fill bar and refactored UI more...

This commit is contained in:
Ognjen Milan Robovic 2024-05-01 09:55:56 -04:00
parent ab48e7100a
commit cc1c48753d
4 changed files with 24 additions and 4 deletions

View File

@ -163,6 +163,8 @@ begin
--
menu_render;
--
ui.draw_fill_bar (400, 400, 400, 0.6);
--
ui.synchronize;
--
ui.draw_help_box (0, core.window_height - text_box_height, core.window_width, text_box_height);

View File

@ -43,10 +43,12 @@ package body ui is
------------------------------------------------------------------------------------------
structure_limit : constant natural := 12;
sprite : array (style, element) of core.sprite;
font : array (style) of core.font;
structure_array : array (0 .. 12) of structure;
structure_array : array (0 .. structure_limit) of structure;
structure_count : natural := 0;
@ -180,7 +182,7 @@ package body ui is
procedure synchronize is
begin
for index in 0 .. 12 loop
for index in 0 .. structure_limit loop
exit when index = structure_count;
--
if core.signal_mode = core.signal_code'pos (structure_array (index).toggle) then
@ -323,6 +325,21 @@ package body ui is
------------------------------------------------------------------------------------------
procedure draw_fill_bar (x, y, width : in integer; fill : in float) is
middle_width : constant integer := width - sprite (active, fill_bar_left).width - sprite (active, fill_bar_right).width;
fill_width : constant integer := integer (float (middle_width) * fill);
begin
draw (fill_bar_left, x, y - sprite (active, fill_bar_left).height);
draw (fill_bar_right, x + middle_width + sprite (active, fill_bar_left).width, y - sprite (active, fill_bar_right).height);
--
draw_horizontally (fill_bar_horizontal, x + sprite (active, fill_bar_left).width, y - sprite (active, fill_bar_horizontal).height, middle_width);
draw_horizontally (fill_horizontal, x + sprite (active, fill_bar_left).width, y - sprite (active, fill_bar_horizontal).height, fill_width);
--
select_text_box ("", x, y, width, sprite (active, fill_bar_horizontal).height);
end draw_fill_bar;
------------------------------------------------------------------------------------------
procedure draw_scroll_bar (x, y, height : in integer; offset : in integer) is
middle_height : constant integer := height - sprite (active, scroll_bar_upper).height - sprite (active, scroll_bar_lower).height;
begin
@ -408,7 +425,7 @@ package body ui is
------------------------------------------------------------------------------------------
procedure draw_state_box (x, y : in integer) is
procedure draw_state_box (x, y : in integer) is -- TODO: Delete this at some point.
begin
ui.write ("Cursor X:" & core.cursor.x'image, x, y + 0);
ui.write ("Cursor Y:" & core.cursor.y'image, x, y + 32);
@ -423,7 +440,7 @@ package body ui is
------------------------------------------------------------------------------------------
procedure add_structure (data : in structure) is
procedure add_structure (data : in structure) is -- TODO: This is dumb, tho less error-prone...
begin
structure_array (structure_count) := data;
--

View File

@ -58,6 +58,7 @@ package ui is
procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle'access);
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_scroll_bar (x, y, height : in integer; offset : in integer);
procedure draw_menu (x, y, width, height : in integer);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 825 B