action menu: Added initial text drawing
authorLukas Krickl <lukas@krickl.dev>
Sat, 30 Aug 2025 18:02:20 +0000 (20:02 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 30 Aug 2025 18:02:20 +0000 (20:02 +0200)
src/action_menu.s
src/select_menu.s
src/ui.s

index 74fa9199d2779a57403d3e5129e670d0adb0b731..4592490132af12df76004cbb42030fca5d68e5d7 100644 (file)
@@ -62,6 +62,7 @@ action_menu_init:
 
        ; draw the initial status line
        ld a, [action_menu_cursor]
+       ld hl, action_menu_str_table
        call select_menu_draw_status
 
        ret
index 70b6ac9fc992c47a325cca9b359f37ccfc440b5f..20ab07b475c87c95bb22c3ef0056cd7368e876f8 100644 (file)
@@ -17,9 +17,27 @@ select_menu_update:
        ;               hl: string ptr table
        ;                a: selection
 select_menu_draw_status:
+       push hl
+       push af
+       call ui_clear_status_line 
+       pop af
+       pop hl
+
        add a, a ; * 2 for table offset
        ld d, 0
        ld e, a
        add hl, de ; hl = string ptr
+       
+       ld a, [hl+]
+       ld d, a
+       ld a, [hl]
+       ; hl = the string
+       ld h, a
+       ld l, d
+
+       ld de, UI_STATUS_LINE
+       call puts
+       call ui_request_redraw
+
 
        ret
index 8b9e8b5df6b3e98d5a6997efd92365dac7c64b3b..e5b4db9af7cf9d81c66da6f78195571a2baa5175 100644 (file)
--- a/src/ui.s
+++ b/src/ui.s
@@ -6,6 +6,10 @@
 ; one tile after 'Z'
 #define UI_WINDOW_BACKGROUND 0xF4  
 
+ui_str_clear:
+.str "                "
+.db 0
+
   ; inits UI
 ui_init:
   ; fill shadow UI with default tile
@@ -99,3 +103,10 @@ ui_draw_status_stat:
        call ui_request_redraw
        
        ret
+       
+       ; clears the UI status line
+ui_clear_status_line:  
+       ld de, UI_STATUS_LINE
+       ld hl, ui_str_clear 
+       jp puts
+