From df21c0f24f7b094853e2ed29d1e01da4ef1647b3 Mon Sep 17 00:00:00 2001 From: xolatile Date: Fri, 15 Mar 2024 18:21:07 -0400 Subject: [PATCH] New skill menu... --- source/main.adb | 4 ++-- source/skill.adb | 11 ++++++----- source/ui.adb | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/main.adb b/source/main.adb index 8ef04c4..c97ca48 100644 --- a/source/main.adb +++ b/source/main.adb @@ -95,9 +95,9 @@ begin -- ui.draw_state_box (preview_width + 32, 32); -- - attribute.menu (300, 200, false); + --~attribute.menu (300, 200, false); skill.menu (600, 300, true); - resource.menu (300, 500, false); + --~resource.menu (300, 500, false); --~unit.menu (300, 500, true); -- --~unit.stat (unit.griffin, 0, 0, true); diff --git a/source/skill.adb b/source/skill.adb index a593dce..5db0e92 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -26,9 +26,10 @@ package body skill is ------------------------------------------------------------------------------------------ procedure menu (x, y : in integer; center : in boolean) is + column : constant integer := 4; offset : constant integer := 16; - width : constant integer := 216 + 2 * offset; - height : constant integer := count * core.icon + 2 * offset; + width : constant integer := 216 * column + 2 * offset; + height : constant integer := (count / column) * core.icon + 2 * offset; move_x : constant integer := (if center then (core.window_width - width) / 2 else x); move_y : constant integer := (if center then (core.window_height - height) / 2 else y); begin @@ -37,9 +38,9 @@ package body skill is -- for index in codex loop - ui.draw_icon (trait (index).text, move_x + offset, move_y + offset + codex'pos (index) * core.icon); - draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon); - core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon, ui.font (ui.active)); + 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)); end loop; end menu; diff --git a/source/ui.adb b/source/ui.adb index b6e00d2..b6bd6ee 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -1,4 +1,4 @@ -with core, ui; + with core, ui; use ui;