Added fill bar and refactored UI more...
This commit is contained in:
parent
ab48e7100a
commit
cc1c48753d
@ -163,6 +163,8 @@ begin
|
|||||||
--
|
--
|
||||||
menu_render;
|
menu_render;
|
||||||
--
|
--
|
||||||
|
ui.draw_fill_bar (400, 400, 400, 0.6);
|
||||||
|
--
|
||||||
ui.synchronize;
|
ui.synchronize;
|
||||||
--
|
--
|
||||||
ui.draw_help_box (0, core.window_height - text_box_height, core.window_width, text_box_height);
|
ui.draw_help_box (0, core.window_height - text_box_height, core.window_width, text_box_height);
|
||||||
|
@ -43,10 +43,12 @@ package body ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
structure_limit : constant natural := 12;
|
||||||
|
|
||||||
sprite : array (style, element) of core.sprite;
|
sprite : array (style, element) of core.sprite;
|
||||||
font : array (style) of core.font;
|
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;
|
structure_count : natural := 0;
|
||||||
|
|
||||||
@ -180,7 +182,7 @@ package body ui is
|
|||||||
|
|
||||||
procedure synchronize is
|
procedure synchronize is
|
||||||
begin
|
begin
|
||||||
for index in 0 .. 12 loop
|
for index in 0 .. structure_limit loop
|
||||||
exit when index = structure_count;
|
exit when index = structure_count;
|
||||||
--
|
--
|
||||||
if core.signal_mode = core.signal_code'pos (structure_array (index).toggle) then
|
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
|
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;
|
middle_height : constant integer := height - sprite (active, scroll_bar_upper).height - sprite (active, scroll_bar_lower).height;
|
||||||
begin
|
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
|
begin
|
||||||
ui.write ("Cursor X:" & core.cursor.x'image, x, y + 0);
|
ui.write ("Cursor X:" & core.cursor.x'image, x, y + 0);
|
||||||
ui.write ("Cursor Y:" & core.cursor.y'image, x, y + 32);
|
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
|
begin
|
||||||
structure_array (structure_count) := data;
|
structure_array (structure_count) := data;
|
||||||
--
|
--
|
||||||
|
@ -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_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_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_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: 483 B After Width: | Height: | Size: 825 B |
Loading…
Reference in New Issue
Block a user