From 67bed146433bbe6576fefd425c1e3dbd41f797ab Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 20 Mar 2024 07:41:40 -0400 Subject: [PATCH] Menu system quick fix and screen overlay. --- source/core.adb | 13 +++++++++++-- source/core.ads | 2 ++ source/main.adb | 9 +++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/source/core.adb b/source/core.adb index 41fc737..6bf2b13 100644 --- a/source/core.adb +++ b/source/core.adb @@ -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_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_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 begin - draw_line (x1, y1, x2, y2, (255, 60, 60, 255)); + draw_line (x1, y1, x2, y2, (0, 0, 0, 255)); end render_vector; function window_width return integer is begin return get_screen_width; end window_width; @@ -580,7 +582,7 @@ package body core is -- begin_drawing; -- - clear_background ((60, 255, 50, 255)); + clear_background ((50, 60, 70, 255)); 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 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; diff --git a/source/core.ads b/source/core.ads index 936a935..e103c1d 100644 --- a/source/core.ads +++ b/source/core.ads @@ -144,6 +144,8 @@ package core is procedure play_song (index : in integer); procedure stop_song (index : in integer); + procedure overlay; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end core; diff --git a/source/main.adb b/source/main.adb index 998209c..7a8dcbc 100644 --- a/source/main.adb +++ b/source/main.adb @@ -28,6 +28,8 @@ procedure main is procedure menu_insert (index : in menu_index) is begin + if menu_count = menu_limit then return; end if; + -- menu_count := menu_count mod menu_limit + 1; -- menu_stack (menu_count) := index; @@ -36,6 +38,7 @@ procedure main is procedure menu_remove is begin if menu_count = 0 then return; end if; + -- menu_stack (menu_count) := menu_none; -- menu_count := menu_count - 1; @@ -43,6 +46,10 @@ procedure main is procedure menu_render is begin + if menu_count > 0 then + core.overlay; + end if; + -- for index in 1 .. menu_limit loop case menu_stack (index) is @@ -152,6 +159,8 @@ begin -- 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); end loop gameplay;