aboutsummaryrefslogtreecommitdiff
path: root/example/generation.adb
blob: a3ed893e0058be618ff42439d3f79196e3eb2143 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
with Raylib;
use  Raylib;

procedure Preview is

   type Texture_Index is (
      Archery,
      Barracks,
      Blacksmith,
      Castle,
      House_1,
      House_2,
      House_3,
      Stable,
      Terrain,
      Tree_1,
      Tree_2,
      Tree_3
   );

   Texture_Array : array (Texture_Index) of Texture;

begin
   Open_Window (1280, 720, "Pandemos Empire" & ASCII.NUL);
   --
   for I in Texture_Index
   loop
      Texture_Array (I) := Load_Texture ("./example/resource/"
                                        & Texture_Index'Image (I)
                                        & ".png"
                                        & ASCII.NUL);
   end loop;
   --
   until Window_Should_Close
   loop
      Begin_Drawing;
      for Y in 0 .. Get_Screen_Height / Terrain.Height - 2
         for X in 0 .. Get_Screen_Width / Terrain.Width - 2
            Draw_Texture (Data => Texture_Array (Terrain),
                          X    => X * Terrain.Width,
                          Y    => Y * Terrain.Height);
      End_Drawing;
   end loop;
   --
   for I in Texture_Index
   loop
      Unload_Texture (Texture_Array (I));
   end loop;
   --
   Close_Window;
end Preview;