raylib-ada/example/generation.adb

66 lines
1.7 KiB
Ada

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;
begin
Open_Window (1280, 720, "Pandemos Empire" & 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 / Texture_Array (Terrain).Height loop
for X in 0 .. Get_Screen_Width / Texture_Array (Terrain).Width loop
Draw_Texture (Data => Texture_Array (Terrain),
X => X * Texture_Array (Terrain).Width,
Y => Y * Texture_Array (Terrain).Height);
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;