diff options
author | rexim <reximkut@gmail.com> | 2024-03-23 23:13:02 +0700 |
---|---|---|
committer | rexim <reximkut@gmail.com> | 2024-03-23 23:13:02 +0700 |
commit | 94f0ac4c21d6bc977c60596c04159194fa7f014a (patch) | |
tree | 4ef59b60bd48ad9a9337ee56520587391c63933c /test.adb | |
parent | eee6e99a8d38058a7f9c7d0869f329fc90cea97d (diff) |
Sounds
Diffstat (limited to 'test.adb')
-rw-r--r-- | test.adb | 41 |
1 files changed, 10 insertions, 31 deletions
@@ -1,40 +1,19 @@ with Text_IO; use Text_IO; with Raylib; use Raylib; with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; with Ada.Unchecked_Conversion; function Test return Integer is - function Clamp(X, Lo, Hi: Float) return Float is - begin - if X < Lo then - return Lo; - elsif X > Hi then - return Hi; - else - return X; - end if; - end; - - function Repeat(T, Length: Float) return Float is - function Floorf(A: C_Float) return C_Float - with - Import => True, - Convention => C, - External_Name => "floorf"; - begin - return Clamp(T - Float(Floorf(C_Float(T/Length)))*Length, 0.0, Length); - end; - - function Delta_Angle(A, B: Float) return Float is - Dlt: Float := Repeat(B - A, 360.0); - begin - if Dlt > 180.0 then - Dlt := Dlt - 360.0; - end if; - return Dlt - end; + Sample: Sound; begin - Put_Line(Float'Image(Repeat(-1.0, 360.0))); + Init_Window(800, 600, To_C("Test")); + Init_Audio_Device; + Sample := Load_Sound(To_C("assets/footsteps/boots/1.ogg")); + Play_Sound(Sample); + while not Window_Should_Close loop + Begin_Drawing; + End_Drawing; + end loop; + Close_Window; return 0; end; |