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.

46 lines
1.8KB

  1. -- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
  2. --
  3. -- GNU General Public Licence (version 3 or later)
  4. with core, ui, effect, resource, faction;
  5. package body construction is
  6. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  7. procedure configure is
  8. begin
  9. core.echo (core.comment, "Configuring construction components...");
  10. --
  11. for index in enumeration loop
  12. declare folder : constant string := core.lowercase (faction.enumeration'image (trait (index).kind));
  13. file : constant string := core.lowercase (enumeration'image (index));
  14. begin
  15. sprite (index) := core.import_sprite (core.folder & "/game/construction/" & folder & "/" & file & ".png", trait (index).frames, 1);
  16. end;
  17. end loop;
  18. end configure;
  19. ------------------------------------------------------------------------------------------
  20. procedure draw (index : in enumeration; x, y : in integer) is
  21. begin
  22. core.draw (sprite (index), x, y);
  23. end draw;
  24. ------------------------------------------------------------------------------------------
  25. procedure draw_plus (index : in enumeration; x, y : in integer) is
  26. use type core.cursor_code;
  27. begin
  28. draw (index, x, y);
  29. --
  30. if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) and core.cursor_mode = core.cursor_right and not ui.prioritize then
  31. core.write_text_box (trait (index).name);
  32. end if;
  33. end draw_plus;
  34. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  35. end construction;