Browse Source

Added fill bar and refactored UI more...

master
parent
commit
cc1c48753d
4 changed files with 24 additions and 4 deletions
  1. +2
    -0
      source/main.adb
  2. +21
    -4
      source/ui.adb
  3. +1
    -0
      source/ui.ads
  4. BIN
      sprite/ui/dwarf/fill_bar_left.png

+ 2
- 0
source/main.adb 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);


+ 21
- 4
source/ui.adb 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;
--


+ 1
- 0
source/ui.ads 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);


BIN
sprite/ui/dwarf/fill_bar_left.png View File

Before After
Width: 32  |  Height: 32  |  Size: 483B Width: 48  |  Height: 48  |  Size: 825B

Loading…
Cancel
Save