Prototype game engine for Heroes of Might & Magic, featuring a gameplay plot-twist...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 line
2.3KB

  1. -- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
  2. --
  3. -- GNU General Public Licence (version 3 or later)
  4. with core, ui, attribute;
  5. package body attribute is
  6. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  7. sprite : array (enumeration) of core.sprite;
  8. ------------------------------------------------------------------------------------------
  9. procedure configure is
  10. begin
  11. core.echo (core.comment, "Configuring attribute components...");
  12. --
  13. ui.add_structure ((title => "Attribute Menu ",
  14. toggle => core.signal_a,
  15. show => false,
  16. center => true,
  17. resize => true,
  18. gui_n => 0,
  19. gui_list => (others => ui.empty),
  20. others => 0));
  21. --
  22. for index in enumeration loop
  23. sprite (index) := core.import_sprite ("./sprite/attribute/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
  24. --
  25. ui.add_structure_button (sprite (index), trait (index).name);
  26. end loop;
  27. end configure;
  28. ------------------------------------------------------------------------------------------
  29. procedure menu (x, y : in integer; center : in boolean) is
  30. offset : constant integer := 16;
  31. width : constant integer := 180 + 2 * offset;
  32. height : constant integer := count * core.icon + 2 * offset;
  33. move_x : constant integer := (if center then (core.window_width - width) / 2 else x);
  34. move_y : constant integer := (if center then (core.window_height - height) / 2 else y);
  35. begin
  36. ui.draw_tiny_menu (move_x, move_y, width, height);
  37. ui.draw_title_bar (move_x, move_y, width, "Attributes");
  38. --
  39. for index in enumeration loop
  40. ui.draw_icon (sprite (index), trait (index).text, move_x + offset, move_y + offset + enumeration'pos (index) * core.icon);
  41. ui.write (trait (index).name, move_x + offset + core.icon, move_y + offset + enumeration'pos (index) * core.icon);
  42. end loop;
  43. end menu;
  44. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  45. end attribute;