New generation example...

This commit is contained in:
Ognjen Milan Robovic 2024-04-23 12:15:11 -04:00
parent c173a91ff2
commit ebd9faf5dd
3 changed files with 58 additions and 3 deletions

View File

@ -12,7 +12,12 @@ gnatmake -c preview.adb
gnatbind preview.ali gnatbind preview.ali
gnatlink preview.ali -lraylib gnatlink preview.ali -lraylib
gnatmake -c generation.adb
gnatbind generation.ali
gnatlink generation.ali -lraylib
mv window ../window mv window ../window
mv preview ../preview mv preview ../preview
mv preview ../generation
exit exit

51
example/generation.adb Normal file
View File

@ -0,0 +1,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;

View File

@ -10,9 +10,8 @@ begin
-- --
Map := Load_Texture ("./example/resource/pandemos.png" & ASCII.NUL); Map := Load_Texture ("./example/resource/pandemos.png" & ASCII.NUL);
-- --
Main_Loop: loop while not Window_Should_Close
exit when Window_Should_Close; loop
--
Begin_Drawing; Begin_Drawing;
Draw_Texture (Map); Draw_Texture (Map);
End_Drawing; End_Drawing;