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.

62 lines
2.6KB

  1. -- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
  2. --
  3. -- GNU General Public Licence (version 3 or later)
  4. with core, ui, skill;
  5. package body skill 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 skill components...");
  13. --
  14. structure.title := "Skill Menu ";
  15. structure.toggle := core.signal_s;
  16. structure.show := false;
  17. structure.center := false;
  18. structure.resize := true;
  19. structure.x := 80;
  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/skill/" & 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 e is begin core.echo (core.warning, "Heyo world!"); end e;
  33. procedure menu (x, y : in integer; center : in boolean) is
  34. column : constant integer := 2;
  35. offset : constant integer := 32;
  36. width : constant integer := 216 * column + 2 * offset;
  37. height : constant integer := (count / column) * core.icon + 2 * offset;
  38. move_x : constant integer := (if center then (core.window_width - width) / 2 else x);
  39. move_y : constant integer := (if center then (core.window_height - height) / 2 else y);
  40. begin
  41. ui.draw_tiny_menu (move_x, move_y, width, height);
  42. ui.draw_title_bar (move_x, move_y, width, "Skills");
  43. --
  44. for index in enumeration loop
  45. ui.draw_icon (sprite (index), trait (index).text, move_x + 216 * (enumeration'pos (index) mod column) + offset, move_y + core.icon * (enumeration'pos (index) / column) + offset, e'access);
  46. ui.write (trait (index).name, move_x + 216 * (enumeration'pos (index) mod column) + offset + core.icon, move_y + core.icon * (enumeration'pos (index) / column) + offset);
  47. end loop;
  48. end menu;
  49. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  50. end skill;