Ada bindings for Raylib 5.1 library.
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.

68 line
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. Tile_Size : Natural := 64; -- Texture_Array (Terrain).Height/Width
  20. begin
  21. Open_Window (1280, 720, "Demo 1440 <Q to Quit>" & ASCII.NUL);
  22. --
  23. Set_Exit_Key (Key_Q);
  24. Set_Target_FPS (1);
  25. --
  26. for I in Texture_Index loop
  27. Texture_Array (I) := Load_Texture ("./example/resource/"
  28. & Texture_Index'Image (I)
  29. & ".png"
  30. & ASCII.NUL);
  31. end loop;
  32. --
  33. loop exit when Window_Should_Close;
  34. Begin_Drawing;
  35. --
  36. for Y in 0 .. Get_Screen_Height / Tile_Size loop
  37. for X in 0 .. Get_Screen_Width / Tile_Size loop
  38. Draw_Texture (Data => Texture_Array (Terrain),
  39. X => X * Tile_Size,
  40. Y => Y * Tile_Size);
  41. end loop;
  42. end loop;
  43. --
  44. for Building in Archery .. Stable loop
  45. Draw_Texture (Data => Texture_Array (Building),
  46. X => Get_Random_Value(0, Get_Screen_Width),
  47. Y => Get_Random_Value(0, Get_Screen_Height));
  48. end loop;
  49. --
  50. Draw_Texture (Texture_Array (Tree_1));
  51. Draw_Texture (Texture_Array (Tree_2), 640, 360);
  52. Draw_Texture (Texture_Array (Tree_3), 960, 360);
  53. --
  54. End_Drawing;
  55. end loop;
  56. --
  57. for I in Texture_Index loop
  58. Unload_Texture (Texture_Array (I));
  59. end loop;
  60. --
  61. Close_Window;
  62. end Generation;