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.

59 line
2.4KB

  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. structure : ui.structure;
  11. begin
  12. core.echo (core.comment, "Configuring attribute components...");
  13. --
  14. structure.title := "Attribute Menu ";
  15. structure.toggle := core.signal_a;
  16. structure.show := false;
  17. structure.center := true;
  18. structure.resize := true;
  19. structure.x := 880;
  20. structure.y := (core.window_height - 320) / 2;
  21. structure.gui_n := count;
  22. --
  23. ui.add_structure (structure);
  24. --
  25. for index in enumeration loop
  26. sprite (index) := core.import_sprite ("./sprite/attribute/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
  27. --
  28. ui.add_structure_button (sprite (index), trait (index).name, trait (index).text);
  29. end loop;
  30. end configure;
  31. ------------------------------------------------------------------------------------------
  32. procedure menu (x, y : in integer; center : in boolean) is
  33. offset : constant integer := 16;
  34. width : constant integer := 180 + 2 * offset;
  35. height : constant integer := count * core.icon + 2 * offset;
  36. move_x : constant integer := (if center then (core.window_width - width) / 2 else x);
  37. move_y : constant integer := (if center then (core.window_height - height) / 2 else y);
  38. begin
  39. ui.draw_tiny_menu (move_x, move_y, width, height);
  40. ui.draw_title_bar (move_x, move_y, width, "Attributes");
  41. --
  42. for index in enumeration loop
  43. ui.draw_icon (sprite (index), trait (index).text, move_x + offset, move_y + offset + enumeration'pos (index) * core.icon);
  44. ui.write (trait (index).name, move_x + offset + core.icon, move_y + offset + enumeration'pos (index) * core.icon);
  45. end loop;
  46. end menu;
  47. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  48. end attribute;