diff --git a/source/core.adb b/source/core.adb index 9241534..74b3ac4 100644 --- a/source/core.adb +++ b/source/core.adb @@ -129,6 +129,13 @@ package body core is ------------------------------------------------------------------------------------------ + procedure debug (text : in string) is + begin + put_line (text); + end debug; + + ------------------------------------------------------------------------------------------ + procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean) is crop_width : constant integer := width mod hexagon_grid_sprite.width; crop_height : constant integer := height mod hexagon_grid_sprite.height; diff --git a/source/core.ads b/source/core.ads index 91e0a46..a29b026 100644 --- a/source/core.ads +++ b/source/core.ads @@ -106,6 +106,7 @@ package core is procedure line (origin, offset : in vector_2); procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#); + procedure debug (text : in string); procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean); diff --git a/source/main.adb b/source/main.adb index 49040d5..68aa667 100644 --- a/source/main.adb +++ b/source/main.adb @@ -116,8 +116,8 @@ begin menu.draw (menu.skill_information, 700, 100, false); menu.draw (menu.resource_information, 400, 100, false); -- - core.write ("Menu :" & menu.trait (menu.mouse_over_menu).title, preview_width + 32, 32 + 320, 16#CCCCCC#); - --~core.write ("Menu Element :" & menu.trait (menu.mouse_over_menu_element).name, preview_width + 32, 32 + 352, 16#CCCCCC#); + core.write ("Menu :" & menu.trait (menu.mouse_over_menu).title, preview_width + 32, 32 + 320, 16#CCCCCC#); + core.write ("Menu Element :" & menu.trait (menu.mouse_over_menu).elements (menu.mouse_over_menu_element).text, preview_width + 32, 32 + 352, 16#CCCCCC#); end loop gameplay; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/menu.adb b/source/menu.adb index 7e14520..0b9b959 100644 --- a/source/menu.adb +++ b/source/menu.adb @@ -18,7 +18,7 @@ package body menu is trait (attribute_information) := ("Attribute Information ", attribute.count, 10, 100, 64, new element_array (0 .. attribute.count - 1)); trait (skill_information) := ("Skill Information ", skill.count, 10, 700, 64, new element_array (0 .. skill.count - 1)); trait (resource_information) := ("Resource Information ", resource.count, 10, 400, 64, new element_array (0 .. resource.count - 1)); - trait (none) := ("-- ", 0, 10, 0, 0, null); + trait (none) := ("-- ", 2, 10, 0, 0, new element_array (0 .. 1)); -- for index in attribute.codex loop @@ -34,6 +34,11 @@ package body menu is loop trait (resource_information).elements (resource.codex'pos (index)) := (button, resource.codex'pos (index), resource.trait (index).name, resource.icon (index)); end loop; + -- + for index in 0 .. 1 + loop + trait (none).elements (index) := (button, index, "-- ", resource.icon (resource.gold)); + end loop; end configure; ------------------------------------------------------------------------------------------ @@ -41,6 +46,9 @@ package body menu is procedure synchronize is limitation : integer; begin + mouse_over_menu := none; + mouse_over_menu_element := 0; + -- for index in codex loop limitation := (if trait (index).length < trait (index).height then trait (index).length else trait (index).height); @@ -50,9 +58,17 @@ package body menu is and core.cursor_y > trait (index).y and core.cursor_y < trait (index).y + limitation * offset + 2 * draw_offset then mouse_over_menu := index; + end if; + -- + if mouse_over_menu /= none then + for element_index in 0 .. limitation - 1 + loop + if core.cursor_y > trait (index).y + draw_offset + element_index * offset + and core.cursor_y < trait (index).y + draw_offset + element_index * offset + offset then + mouse_over_menu_element := element_index; + end if; + end loop; return; - else - mouse_over_menu := none; end if; end loop; end synchronize; diff --git a/source/menu.ads b/source/menu.ads index 873d924..eb48cfb 100644 --- a/source/menu.ads +++ b/source/menu.ads @@ -39,7 +39,7 @@ package menu is ------------------------------------------------------------------------------------------ mouse_over_menu : codex; - mouse_over_menu_element : codex; + mouse_over_menu_element : integer; trait : trait_array;