Skip to content

Commit a4e13c7

Browse files
committed
Port Source Code to Ada 2012
1 parent 0252eb2 commit a4e13c7

File tree

5 files changed

+41
-40
lines changed

5 files changed

+41
-40
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- @Eropi4 - MacOS build - https://github.com/tsoding/eepers/pull/13
44
- @cornishon - Sprint with Right Shift - https://github.com/tsoding/eepers/pull/18
5+
- Port the Source Code to Ada 2012 making it accessible to more setups. We were not using anything important from Ada 2022 anyway.
56
- ...
67

78
# Eepers v1.2

build-linux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -xe
44

5-
gnatmake -f -O3 -Wall -Wextra -gnat2022 eepers.adb -bargs -static -largs -L./raylib/raylib-5.0_linux_amd64/lib/ -l:libraylib.a -lm
5+
gnatmake -f -O3 -Wall -Wextra -gnat2012 eepers.adb -bargs -static -largs -L./raylib/raylib-5.0_linux_amd64/lib/ -l:libraylib.a -lm
66
./eepers
77

88
# gnatmake -f -Wall -Wextra -gnat2022 test.adb -largs -L./raylib/raylib-5.0_linux_amd64/lib/ -l:libraylib.a -lm

build-macos.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -xe
44

5-
gnatmake -f -O3 -Wall -Wextra -gnat2022 eepers.adb -bargs -static -largs -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL ./raylib/raylib-5.0_macos/lib/libraylib.a
5+
gnatmake -f -O3 -Wall -Wextra -gnat2012 eepers.adb -bargs -static -largs -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL ./raylib/raylib-5.0_macos/lib/libraylib.a
66

77
# Bundle executable in an Application
88
rm -rf ./eepers.app
@@ -30,4 +30,4 @@ echo '<?xml version="1.0" encoding="UTF-8"?>
3030
<key>CFBundleIconFile</key>
3131
<string>icon.ico</string>
3232
</dict>
33-
</plist>' > eepers.app/Contents/Info.plist
33+
</plist>' > eepers.app/Contents/Info.plist

build-mingw32-w64.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -xe
44

55
x86_64-w64-mingw32-windres eepers.rc -O coff -o eepers.res
6-
x86_64-w64-mingw32-gnatmake-win32 -mwindows -O3 -f -Wall -Wextra -gnat2022 eepers.adb -bargs -static -largs eepers.res -L./raylib/raylib-5.0_win64_mingw-w64/lib/ -l:libraylib.a -lwinmm -lgdi32 -static
6+
x86_64-w64-mingw32-gnatmake-win32 -mwindows -O3 -f -Wall -Wextra -gnat2012 eepers.adb -bargs -static -largs eepers.res -L./raylib/raylib-5.0_win64_mingw-w64/lib/ -l:libraylib.a -lwinmm -lgdi32 -static

eepers.adb

+36-36
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ procedure Eepers is
2323

2424
type Footsteps_Range is mod 4;
2525
Footsteps_Sounds: array (Footsteps_Range) of Sound;
26-
Footsteps_Pitches: constant array (Footsteps_Range) of C_Float := [1.7, 1.6, 1.5, 1.4];
26+
Footsteps_Pitches: constant array (Footsteps_Range) of C_Float := (1.7, 1.6, 1.5, 1.4);
2727
package Random_Footsteps is
2828
new Ada.Numerics.Discrete_Random(Result_Subtype => Footsteps_Range);
2929
Footsteps_Gen: Random_Footsteps.Generator;
@@ -67,8 +67,8 @@ procedure Eepers is
6767
return Color_From_HSV(H, S, V);
6868
end;
6969

70-
Palette_RGB: array (Palette) of Color := [others => (A => 255, others => 0)];
71-
Palette_HSV: array (Palette) of HSV := [others => [others => 0]];
70+
Palette_RGB: array (Palette) of Color := (others => (A => 255, others => 0));
71+
Palette_HSV: array (Palette) of HSV := (others => (others => 0));
7272

7373
package Double_IO is new Ada.Text_IO.Float_IO(Double);
7474

@@ -228,34 +228,34 @@ procedure Eepers is
228228
type Eye_Mesh is new Vector2_Array(1..4);
229229
type Eye is (Left_Eye, Right_Eye);
230230
type Eyes_Mesh is array (Eye) of Eye_Mesh;
231-
Eyes_Meshes: constant array (Eyes_Kind) of Eyes_Mesh := [
232-
Eyes_Open => [
231+
Eyes_Meshes: constant array (Eyes_Kind) of Eyes_Mesh := (
232+
Eyes_Open => (
233233
-- 1-3
234234
-- |/|
235235
-- 2-4
236-
Left_Eye => [ (0.0, 0.0), (0.0, 1.0), (1.0, 0.0), (1.0, 1.0) ],
236+
Left_Eye => ( (0.0, 0.0), (0.0, 1.0), (1.0, 0.0), (1.0, 1.0) ),
237237
-- 3-4
238238
-- |\|
239239
-- 1-2
240-
Right_Eye => [ (0.0, 1.0), (1.0, 1.0), (0.0, 0.0), (1.0, 0.0) ]
241-
],
242-
Eyes_Closed => [
243-
Left_Eye => [ (0.0, 0.8), (0.0, 1.0), (1.0, 0.8), (1.0, 1.0) ],
244-
Right_Eye => [ (0.0, 1.0), (1.0, 1.0), (0.0, 0.8), (1.0, 0.8) ]
245-
],
246-
Eyes_Angry => [
247-
Left_Eye => [ (0.0, 0.0), (0.0, 1.0), (1.0, 0.3), (1.0, 1.0) ],
248-
Right_Eye => [ (0.0, 1.0), (1.0, 1.0), (0.0, 0.3), (1.0, 0.0) ]
249-
],
250-
Eyes_Cringe => [
251-
Left_Eye => [ (0.0, 0.5), (0.25, 0.75), (1.3, 0.75), (0.0, 1.0) ],
252-
Right_Eye => [ (1.0, 1.0), (0.75, 0.75), (-0.3, 0.75), (1.0, 0.5) ]
253-
],
254-
Eyes_Surprised => [
255-
Left_Eye => [ (0.0, 0.3), (0.0, 1.0), (1.0, 0.3), (1.0, 1.0) ],
256-
Right_Eye => [ (0.0, 1.0), (1.0, 1.0), (0.0, 0.0), (1.0, 0.0) ]
257-
]
258-
];
240+
Right_Eye => ( (0.0, 1.0), (1.0, 1.0), (0.0, 0.0), (1.0, 0.0) )
241+
),
242+
Eyes_Closed => (
243+
Left_Eye => ( (0.0, 0.8), (0.0, 1.0), (1.0, 0.8), (1.0, 1.0) ),
244+
Right_Eye => ( (0.0, 1.0), (1.0, 1.0), (0.0, 0.8), (1.0, 0.8) )
245+
),
246+
Eyes_Angry => (
247+
Left_Eye => ( (0.0, 0.0), (0.0, 1.0), (1.0, 0.3), (1.0, 1.0) ),
248+
Right_Eye => ( (0.0, 1.0), (1.0, 1.0), (0.0, 0.3), (1.0, 0.0) )
249+
),
250+
Eyes_Cringe => (
251+
Left_Eye => ( (0.0, 0.5), (0.25, 0.75), (1.3, 0.75), (0.0, 1.0) ),
252+
Right_Eye => ( (1.0, 1.0), (0.75, 0.75), (-0.3, 0.75), (1.0, 0.5) )
253+
),
254+
Eyes_Surprised => (
255+
Left_Eye => ( (0.0, 0.3), (0.0, 1.0), (1.0, 0.3), (1.0, 1.0) ),
256+
Right_Eye => ( (0.0, 1.0), (1.0, 1.0), (0.0, 0.0), (1.0, 0.0) )
257+
)
258+
);
259259

260260
type Player_State is record
261261
Prev_Position: IVector2;
@@ -341,11 +341,11 @@ procedure Eepers is
341341

342342
type Direction is (Left, Right, Up, Down);
343343

344-
Direction_Vector: constant array (Direction) of IVector2 := [
344+
Direction_Vector: constant array (Direction) of IVector2 := (
345345
Left => (X => -1, Y => 0),
346346
Right => (X => 1, Y => 0),
347347
Up => (X => 0, Y => -1),
348-
Down => (X => 0, Y => 1)];
348+
Down => (X => 0, Y => 1));
349349

350350
function Inside_Of_Rect(Start, Size, Point: in IVector2) return Boolean is
351351
begin
@@ -578,7 +578,7 @@ procedure Eepers is
578578
Level_Key,
579579
Level_Player,
580580
Level_Father);
581-
Level_Cell_Color: constant array (Level_Cell) of Color := [
581+
Level_Cell_Color: constant array (Level_Cell) of Color := (
582582
Level_None => Get_Color(16#00000000#),
583583
Level_Gnome => Get_Color(16#FF9600FF#),
584584
Level_Mother => Get_Color(16#96FF00FF#),
@@ -591,7 +591,7 @@ procedure Eepers is
591591
Level_Barricade => Get_Color(16#FF0096FF#),
592592
Level_Key => Get_Color(16#FFFF00FF#),
593593
Level_Player => Get_Color(16#0000FFFF#),
594-
Level_Father => Get_Color(16#265FDAFF#)];
594+
Level_Father => Get_Color(16#265FDAFF#));
595595

596596
function Cell_By_Color(Col: Color; Out_Cel: out Level_Cell) return Boolean is
597597
begin
@@ -897,12 +897,12 @@ procedure Eepers is
897897
end loop;
898898
end;
899899

900-
Keys: constant array (Direction) of int := [
900+
Keys: constant array (Direction) of int := (
901901
Left => KEY_A,
902902
Right => KEY_D,
903903
Up => KEY_W,
904904
Down => KEY_S
905-
];
905+
);
906906

907907
procedure Game_Update_Camera(Game: in out Game_State) is
908908
Camera_Target: constant Vector2 :=
@@ -1209,10 +1209,10 @@ procedure Eepers is
12091209
Eyes_Size: constant Vector2 := Eyes_Ratio*Size;
12101210
Center: constant Vector2 := Start + Size*0.5;
12111211
Position: constant Vector2 := Center + Dir*Eyes_Size.X*0.6;
1212-
Positions: constant array (Eye) of Vector2 := [
1212+
Positions: constant array (Eye) of Vector2 := (
12131213
Left_Eye => Position - Eyes_Size*(0.5, 0.0) - Eyes_Size*(1.0, 0.5),
12141214
Right_Eye => Position + Eyes_Size*(0.5, 0.0) - Eyes_Size*(0.0, 0.5)
1215-
];
1215+
);
12161216
Mesh: Eye_Mesh;
12171217
begin
12181218
for Eye_Index in Eye loop
@@ -1502,7 +1502,7 @@ begin
15021502
TURN_DURATION_SECS := BASE_TURN_DURATION_SECS;
15031503
end if;
15041504
end if;
1505-
1505+
15061506
Any_Key_Pressed := False;
15071507
while not Any_Key_Pressed and then Get_Key_Pressed /= KEY_NULL loop
15081508
Any_Key_Pressed := True;
@@ -1659,8 +1659,8 @@ end;
16591659
-- TODO: Visual Clue that the Eeper is about to kill the Player when Completely outside of the Screen
16601660
-- - Cooldown ball is shaking
16611661
-- TODO: Cool animation for New Game
1662-
-- TODO: Tutorial
1663-
-- - Sign that says "WASD" to move when you start the game for the first time.
1662+
-- TODO: Tutorial
1663+
-- - Sign that says "WASD" to move when you start the game for the first time.
16641664
-- - And how to place the bomb on picking it up.
16651665
-- - How to sprint after you blow up firt Barricade.
16661666
-- TODO: Count the player's turns towards the final score of the game

0 commit comments

Comments
 (0)