From e046565ee4b489e34e2ac283d52840ed0337a6d4 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 16 Mar 2024 06:14:28 -0400 Subject: [PATCH] New skill menu and braindead simple menu stack... --- source/main.adb | 40 +++++++++++++++++++++++++++++++--------- source/skill.adb | 6 +++--- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/source/main.adb b/source/main.adb index c97ca48..55930e4 100644 --- a/source/main.adb +++ b/source/main.adb @@ -15,6 +15,23 @@ procedure main is player : chad.information := chad.trait (chad.ognjen); + type menu_index is ( + none, attribute_menu, skill_menu, resource_menu, unit_menu + ); + + show_menu_index : menu_index := none; + + procedure show_menu is + begin + case show_menu_index is + when none => null; + when attribute_menu => attribute.menu (0, 0, true); + when skill_menu => skill.menu (0, 0, true); + when resource_menu => resource.menu (0, 0, true); + when unit_menu => unit.menu (0, 0, true); + end case; + end show_menu; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ begin @@ -56,10 +73,10 @@ begin -- exit when core.engine_active = false; -- - if core.signal_mode = core.signal_code'pos (core.signal_a) then preview_width := preview_width - 60; end if; - if core.signal_mode = core.signal_code'pos (core.signal_d) then preview_width := preview_width + 60; end if; - if core.signal_mode = core.signal_code'pos (core.signal_w) then preview_height := preview_height - 60; end if; - if core.signal_mode = core.signal_code'pos (core.signal_s) then preview_height := preview_height + 60; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_a) then preview_width := preview_width - 60; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_d) then preview_width := preview_width + 60; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_w) then preview_height := preview_height - 60; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_s) then preview_height := preview_height + 60; end if; -- if core.signal_mode = core.signal_code'pos (core.signal_left) then core.camera.x := core.camera.x - 1; end if; if core.signal_mode = core.signal_code'pos (core.signal_right) then core.camera.x := core.camera.x + 1; end if; @@ -71,7 +88,7 @@ begin core.camera.x := core.clip (core.camera.x, 0, world.map.width - preview_width / core.base); core.camera.y := core.clip (core.camera.y, 0, world.map.height - preview_height / core.base); -- - world.draw (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y - 32, core.cursor_mode = 2); + world.draw (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y - 32, core.signal_mode = core.signal_code'pos (core.signal_g)); -- --~core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y); --~core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y); @@ -95,10 +112,11 @@ begin -- ui.draw_state_box (preview_width + 32, 32); -- - --~attribute.menu (300, 200, false); - skill.menu (600, 300, true); - --~resource.menu (300, 500, false); - --~unit.menu (300, 500, true); + if core.signal_mode = core.signal_code'pos (core.signal_a) then show_menu_index := attribute_menu; end if; + if core.signal_mode = core.signal_code'pos (core.signal_s) then show_menu_index := skill_menu; end if; + if core.signal_mode = core.signal_code'pos (core.signal_r) then show_menu_index := resource_menu; end if; + if core.signal_mode = core.signal_code'pos (core.signal_u) then show_menu_index := unit_menu; end if; + if core.cursor_mode = 2 and show_menu_index /= none then show_menu_index := none; end if; -- --~unit.stat (unit.griffin, 0, 0, true); --~unit.stat (unit.halberdier, 0, 0, true); @@ -108,6 +126,10 @@ begin --~magic.menu (0, 0, true); --~might.menu (0, 0, true); -- + --~ui.synchronize; + -- + show_menu; + -- ui.draw_text_box (0, core.window_height - 32, core.window_width, 32); end loop gameplay; diff --git a/source/skill.adb b/source/skill.adb index 5db0e92..2e9d1e5 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -38,9 +38,9 @@ package body skill is -- for index in codex loop - ui.draw_icon (trait (index).text, move_x + 216 * (codex'pos (index) mod 4) + offset, move_y + core.icon * (codex'pos (index) / 4) + offset); - draw (index, move_x + 216 * (codex'pos (index) mod 4) + offset, move_y + core.icon * (codex'pos (index) / 4) + offset); - core.write (trait (index).name, move_x + 216 * (codex'pos (index) mod 4) + offset + core.icon, move_y + core.icon * (codex'pos (index) / 4) + offset, ui.font (ui.active)); + ui.draw_icon (trait (index).text, move_x + 216 * (codex'pos (index) / 6) + offset, move_y + core.icon * (codex'pos (index) mod 6) + offset); + draw (index, move_x + 216 * (codex'pos (index) / 6) + offset, move_y + core.icon * (codex'pos (index) mod 6) + offset); + core.write (trait (index).name, move_x + 216 * (codex'pos (index) / 6) + offset + core.icon, move_y + core.icon * (codex'pos (index) mod 6) + offset, ui.font (ui.active)); end loop; end menu;