Menu system quick fix and screen overlay.

This commit is contained in:
Ognjen Milan Robovic 2024-03-20 07:41:40 -04:00
parent ab3006f2b5
commit 67bed14643
3 changed files with 22 additions and 2 deletions

View File

@ -70,6 +70,8 @@ package body core is
-- --
procedure draw_line (x0, y0, x1, y1 : integer; tint : color) with import => true, convention => c, external_name => "DrawLine"; procedure draw_line (x0, y0, x1, y1 : integer; tint : color) with import => true, convention => c, external_name => "DrawLine";
-- --
procedure draw_rectangle (x, y, width, height : integer; tint : color) with import => true, convention => c, external_name => "DrawRectangle";
--
procedure draw_image (data : texture; uv : rectangle; view : vessel; tint : color) with import => true, convention => c, external_name => "DrawTextureRec"; procedure draw_image (data : texture; uv : rectangle; view : vessel; tint : color) with import => true, convention => c, external_name => "DrawTextureRec";
-- --
procedure draw_text (data : font; text : string; view : vessel; size, pad : float; tint : color) with import => true, convention => c, external_name => "DrawTextEx"; procedure draw_text (data : font; text : string; view : vessel; size, pad : float; tint : color) with import => true, convention => c, external_name => "DrawTextEx";
@ -489,7 +491,7 @@ package body core is
procedure render_vector (x1, y1, x2, y2 : in integer) is procedure render_vector (x1, y1, x2, y2 : in integer) is
begin begin
draw_line (x1, y1, x2, y2, (255, 60, 60, 255)); draw_line (x1, y1, x2, y2, (0, 0, 0, 255));
end render_vector; end render_vector;
function window_width return integer is begin return get_screen_width; end window_width; function window_width return integer is begin return get_screen_width; end window_width;
@ -580,7 +582,7 @@ package body core is
-- --
begin_drawing; begin_drawing;
-- --
clear_background ((60, 255, 50, 255)); clear_background ((50, 60, 70, 255));
end synchronize; end synchronize;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@ -588,6 +590,13 @@ package body core is
procedure play_song (index : in integer) is begin play_sound (sound_array (index)); end play_song; procedure play_song (index : in integer) is begin play_sound (sound_array (index)); end play_song;
procedure stop_song (index : in integer) is begin stop_sound (sound_array (index)); end stop_song; procedure stop_song (index : in integer) is begin stop_sound (sound_array (index)); end stop_song;
------------------------------------------------------------------------------------------
procedure overlay is
begin
draw_rectangle (0, 0, window_width, window_height, (0, 0, 0, 100));
end overlay;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end core; end core;

View File

@ -144,6 +144,8 @@ package core is
procedure play_song (index : in integer); procedure play_song (index : in integer);
procedure stop_song (index : in integer); procedure stop_song (index : in integer);
procedure overlay;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end core; end core;

View File

@ -28,6 +28,8 @@ procedure main is
procedure menu_insert (index : in menu_index) is procedure menu_insert (index : in menu_index) is
begin begin
if menu_count = menu_limit then return; end if;
--
menu_count := menu_count mod menu_limit + 1; menu_count := menu_count mod menu_limit + 1;
-- --
menu_stack (menu_count) := index; menu_stack (menu_count) := index;
@ -36,6 +38,7 @@ procedure main is
procedure menu_remove is procedure menu_remove is
begin begin
if menu_count = 0 then return; end if; if menu_count = 0 then return; end if;
--
menu_stack (menu_count) := menu_none; menu_stack (menu_count) := menu_none;
-- --
menu_count := menu_count - 1; menu_count := menu_count - 1;
@ -43,6 +46,10 @@ procedure main is
procedure menu_render is procedure menu_render is
begin begin
if menu_count > 0 then
core.overlay;
end if;
--
for index in 1 .. menu_limit for index in 1 .. menu_limit
loop loop
case menu_stack (index) is case menu_stack (index) is
@ -152,6 +159,8 @@ begin
-- --
menu_render; menu_render;
-- --
core.write (integer'image (menu_count), 16, 16, ui.glyphs (ui.active), 16#FFFFFFFF#);
--
ui.draw_text_box (0, core.window_height - 32, core.window_width, 32); ui.draw_text_box (0, core.window_height - 32, core.window_width, 32);
end loop gameplay; end loop gameplay;