From 8071b8fb81948e723f957affcdafa909ad1cb2c0 Mon Sep 17 00:00:00 2001 From: xolatile Date: Thu, 6 Jun 2024 10:50:00 -0400 Subject: [PATCH] Added player equipment... --- source/main.adb | 27 +++++++++++++++++++++++++++ source/ui.adb | 13 +++++++++++++ 2 files changed, 40 insertions(+) diff --git a/source/main.adb b/source/main.adb index 892359f..cf99381 100644 --- a/source/main.adb +++ b/source/main.adb @@ -197,6 +197,33 @@ procedure main is ui.write ("Mana " & player_1.mana.value'image & " /" & player_1.mana.limit'image, at_x + core.icon, at_y + 10, code => true); ui.write ("Movement" & player_1.movement.value'image & " /" & player_1.movement.limit'image, at_x + core.icon, at_y + core.icon + 10, code => true); -- + at_x := x + offset; + at_y := y + offset + chad.view_height + 3 * core.icon; + -- + for index in equipment.kind loop + if equipment.enumeration'pos (player_1.equipments (index)) /= equipment.enumeration'pos (equipment.none) then + ui.draw_overicon (data => equipment.icon (player_1.equipments (index)), + text => equipment.description (player_1.equipments (index)).name.all, + x => at_x + equipment.kind'pos (index) * core.icon, + y => at_y); + else + ui.draw_overicon (data => equipment.slot (index), + text => "Slot '" & core.lowercase (equipment.kind (index)'image) & "' is empty.", + x => at_x + equipment.kind'pos (index) * core.icon, + y => at_y); + end if; + end loop; + -- + ui.draw_text_box (x => at_x + (equipment.kind'pos (equipment.kind'last) + 1) * core.icon, + y => at_y, + width => width - (equipment.kind'pos (equipment.kind'last) + 1) * core.icon - 2 * offset, + height => core.icon); + -- + ui.write (text => "Equipment", + x => at_x + (equipment.kind'pos (equipment.kind'last) + 1) * core.icon + 10, + y => at_y + 10, + code => true); + -- --~for index_y in 0 .. 3 loop --~for index_x in 0 .. 5 loop --~ui.draw_icon (data => equipment.icon (player_1.items (6 * index_y + index_x)), diff --git a/source/ui.adb b/source/ui.adb index 8f8978f..6d2ffc7 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -174,6 +174,19 @@ package body ui is core.draw (data, x, y, factor => 1); -- draw (overicon, x, y); + -- + if core.cursor_inside (x, y, core.icon / core.zoom, core.icon / core.zoom) then + prioritize := true; + -- + draw (icon_selected, x, y); + -- + core.write_help_box (text); + -- + if core.cursor_mode = core.cursor_left then + action.all; + core.cursor_mode := core.cursor_none; + end if; + end if; end draw_overicon; ------------------------------------------------------------------------------------------