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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
with Raylib;
use Raylib;
procedure Generation 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;
Tile_Size : Natural := 64; -- Texture_Array (Terrain).Height/Width
begin
Open_Window (1280, 720, "Demo 1440 <Q to Quit>" & ASCII.NUL);
--
Set_Exit_Key (Key_Q);
Set_Target_FPS (1);
--
for I in Texture_Index loop
Texture_Array (I) := Load_Texture ("./example/resource/"
& Texture_Index'Image (I)
& ".png"
& ASCII.NUL);
end loop;
--
loop exit when Window_Should_Close;
Begin_Drawing;
--
for Y in 0 .. Get_Screen_Height / Tile_Size loop
for X in 0 .. Get_Screen_Width / Tile_Size loop
Draw_Texture (Data => Texture_Array (Terrain),
X => X * Tile_Size,
Y => Y * Tile_Size);
end loop;
end loop;
--
for Building in Archery .. Stable loop
Draw_Texture (Data => Texture_Array (Building),
X => Get_Random_Value(0, Get_Screen_Width),
Y => Get_Random_Value(0, Get_Screen_Height));
end loop;
--
Draw_Texture (Texture_Array (Tree_1));
Draw_Texture (Texture_Array (Tree_2), 640, 360);
Draw_Texture (Texture_Array (Tree_3), 960, 360);
--
End_Drawing;
end loop;
--
for I in Texture_Index loop
Unload_Texture (Texture_Array (I));
end loop;
--
Close_Window;
end Generation;
|