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.

67 lines
2.3KB

  1. -- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
  2. --
  3. -- GNU General Public Licence (version 3 or later)
  4. with core, ui;
  5. package body skill is
  6. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  7. icon : 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 := true;
  18. structure.resize := true;
  19. structure.x := 80;
  20. structure.y := (core.window_height - 320) / 2;
  21. structure.gui_n := count + 1;
  22. --
  23. ui.add_structure (structure);
  24. --
  25. for index in enumeration loop
  26. icon (index) := core.import_sprite (core.folder & "/icon/skill/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
  27. --
  28. if enumeration'pos (index) = 9 then
  29. ui.add_structure_orient;
  30. end if;
  31. --
  32. ui.add_structure_button (icon (index), trait (index).name, trait (index).text);
  33. end loop;
  34. end configure;
  35. ------------------------------------------------------------------------------------------
  36. procedure draw_points (data : in points; x, y : in integer) is
  37. move_x : integer := x;
  38. move_y : integer := y;
  39. begin
  40. for index in enumeration loop
  41. if (enumeration'pos (index) + 1) mod (count / 2 + 1) = 0 then
  42. move_x := x + 2 * core.icon + 120;
  43. move_y := y;
  44. end if;
  45. --
  46. ui.draw_icon (icon (index), trait (index).text, move_x, move_y);
  47. ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon);
  48. ui.write (data (index)'image, move_x + core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
  49. --
  50. ui.write (trait (index).name, move_x + 2 * core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
  51. --
  52. move_y := move_y + core.icon;
  53. end loop;
  54. end draw_points;
  55. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  56. end skill;