More work on prototype menus...

This commit is contained in:
Ognjen Milan Robovic 2024-02-16 14:58:54 -05:00
parent 7d4587a86e
commit f735870207
6 changed files with 27 additions and 5 deletions

View File

@ -115,9 +115,9 @@ package body core is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure write (text : in string; x, y : in integer) is procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#) is
begin begin
render_string (c_string (text), x, y, 16#CCCCCC#, false); render_string (c_string (text), x, y, colour, false);
end write; end write;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------

View File

@ -101,7 +101,8 @@ package core is
procedure crop (data : in sprite; x, y, u, v, width, height : in integer); procedure crop (data : in sprite; x, y, u, v, width, height : in integer);
procedure draw (data : in sprite; x, y : in integer); procedure draw (data : in sprite; x, y : in integer);
procedure move (data : in sprite; x, y, frame, state : in integer); procedure move (data : in sprite; x, y, frame, state : in integer);
procedure write (text : in string; x, y : in integer);
procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#);
procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean); procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean);

View File

@ -49,6 +49,7 @@ package body menu is
return; return;
end if; end if;
-- --
ui.draw_title_bar (x, y, width, trait (index).title);
ui.draw_tiny_menu (x, y, width, height, true); ui.draw_tiny_menu (x, y, width, height, true);
-- --
for element_index in 0 .. trait (index).length - 1 for element_index in 0 .. trait (index).length - 1

View File

@ -100,7 +100,7 @@ void render_string (char * string, int x, int y, int colour, char monospace) {
new_tint.g = ((colour & 0X00FF00) >> 8) % 256; new_tint.g = ((colour & 0X00FF00) >> 8) % 256;
new_tint.b = ((colour & 0X0000FF) >> 0) % 256; new_tint.b = ((colour & 0X0000FF) >> 0) % 256;
DrawTextPro ((monospace != 0) ? mono : font, string, position, dump, 0.0, 24, 6, new_tint); DrawTextPro ((monospace != 0) ? mono : font, string, position, dump, 0.0, 18, 3, new_tint);
} }
void engine_configure (void) { void engine_configure (void) {

View File

@ -121,6 +121,19 @@ package body ui is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw_title_bar (x, y, width : in integer; title : in string) is
middle_width : constant integer := width - sprite (active, title_bar_left).width - sprite (active, title_bar_right).width;
begin
draw (title_bar_left, x, y - sprite (active, title_bar_left).height);
draw (title_bar_right, x + middle_width + sprite (active, title_bar_left).width, y - sprite (active, title_bar_right).height);
--
draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width);
--
core.write (title, x + sprite (active, title_bar_left).width - 12, y - sprite (active, title_bar_middle).height + 24, 16#222222#);
end draw_title_bar;
------------------------------------------------------------------------------------------
procedure draw_menu (x, y, width, height : in integer; background : in boolean) is procedure draw_menu (x, y, width, height : in integer; background : in boolean) is
offset : constant integer := sprite (active, none).width; offset : constant integer := sprite (active, none).width;
begin begin

View File

@ -17,7 +17,12 @@ package ui is
tiny_border_upper, tiny_border_lower, tiny_border_left, tiny_border_right, tiny_border_upper, tiny_border_lower, tiny_border_left, tiny_border_right,
frame_upper_left, frame_upper, frame_upper_right, frame_upper_left, frame_upper, frame_upper_right,
frame_left, frame_middle, frame_right, frame_left, frame_middle, frame_right,
frame_lower_left, frame_lower, frame_lower_right frame_lower_left, frame_lower, frame_lower_right,
cursor,
fill_bar_left, fill_bar_horizontal, fill_bar_right,
fill_in_left, fill_in_horizontal, fill_in_right,
scroll_bar_lower, scroll_bar_middle, scroll_bar_upper,
title_bar_left, title_bar_middle, title_bar_right
); );
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@ -34,6 +39,8 @@ package ui is
procedure draw_frame (x, y, width, height : in integer); procedure draw_frame (x, y, width, height : in integer);
procedure draw_title_bar (x, y, width : in integer; title : in string);
procedure draw_menu (x, y, width, height : in integer; background : in boolean); procedure draw_menu (x, y, width, height : in integer; background : in boolean);
procedure draw_tiny_menu (x, y, width, height : in integer; background : in boolean); procedure draw_tiny_menu (x, y, width, height : in integer; background : in boolean);