Ada bindings for Raylib 5.1 library.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

66 linhas
1.7KB

  1. with Raylib;
  2. use Raylib;
  3. procedure Generation is
  4. type Texture_Index is (
  5. Archery,
  6. Barracks,
  7. Blacksmith,
  8. Castle,
  9. House_1,
  10. House_2,
  11. House_3,
  12. Stable,
  13. Terrain,
  14. Tree_1,
  15. Tree_2,
  16. Tree_3
  17. );
  18. Texture_Array : array (Texture_Index) of Texture;
  19. begin
  20. Open_Window (1280, 720, "Pandemos Empire" & ASCII.NUL);
  21. --
  22. Set_Exit_Key (Key_Q);
  23. Set_Target_FPS (1);
  24. --
  25. for I in Texture_Index loop
  26. Texture_Array (I) := Load_Texture ("./example/resource/"
  27. & Texture_Index'Image (I)
  28. & ".png"
  29. & ASCII.NUL);
  30. end loop;
  31. --
  32. loop exit when Window_Should_Close;
  33. Begin_Drawing;
  34. --
  35. for Y in 0 .. Get_Screen_Height / Texture_Array (Terrain).Height loop
  36. for X in 0 .. Get_Screen_Width / Texture_Array (Terrain).Width loop
  37. Draw_Texture (Data => Texture_Array (Terrain),
  38. X => X * Texture_Array (Terrain).Width,
  39. Y => Y * Texture_Array (Terrain).Height);
  40. end loop;
  41. end loop;
  42. --
  43. for Building in Archery .. Stable loop
  44. Draw_Texture (Data => Texture_Array (Building),
  45. X => Get_Random_Value(0, Get_Screen_Width),
  46. Y => Get_Random_Value(0, Get_Screen_Height));
  47. end loop;
  48. --
  49. Draw_Texture (Texture_Array (Tree_1));
  50. Draw_Texture (Texture_Array (Tree_2), 640, 360);
  51. Draw_Texture (Texture_Array (Tree_3), 960, 360);
  52. --
  53. End_Drawing;
  54. end loop;
  55. --
  56. for I in Texture_Index loop
  57. Unload_Texture (Texture_Array (I));
  58. end loop;
  59. --
  60. Close_Window;
  61. end Generation;