From c6e1b398a9ce0f79293d9dffeb75820dbb9b351f Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 3 Apr 2024 02:18:42 -0400 Subject: [PATCH] Collision functions... --- raylib.ads | 128 ++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 84 insertions(+), 44 deletions(-) diff --git a/raylib.ads b/raylib.ads index c586679..c226cda 100644 --- a/raylib.ads +++ b/raylib.ads @@ -748,6 +748,8 @@ package Raylib is Direction : Vector_3D := (0.0, 0.0, 0.0); end record with Convention => C_Pass_By_Copy; + No_Ray : Ray; + type Ray_Collision is record Hit : Logical := False; Distance : Float := 0.0; @@ -755,11 +757,15 @@ package Raylib is Normal : Vector_3D := (0.0, 0.0, 0.0); end record with Convention => C_Pass_By_Copy; + No_Ray_Collision : Ray_Collision; + type Bounding_Box is record Min : Vector_3D := (0.0, 0.0, 0.0); Max : Vector_3D := (0.0, 0.0, 0.0); end record with Convention => C_Pass_By_Copy; + No_Bounding_Box : Bounding_Box; + type Wave is record Frame_Count : Natural := 0; Sample_Rate : Natural := 0; @@ -3727,45 +3733,79 @@ package Raylib is --~Convention => C, --~External_Name => ""; - --~function bool CheckCollisionSpheres (Vector3 center1, float radius1, Vector3 center2, float radius2) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Check_Collision_Spheres ( + Center_1 : Vector_3D := (0.0, 0.0, 0.0); + Radius_1 : Float := 0.0; + Center_2 : Vector_3D := (0.0, 0.0, 0.0); + Radius_2 : Float := 0.0 + ) return Logical with + Import => True, + Convention => C, + External_Name => "CheckCollisionSpheres"; - --~function bool CheckCollisionBoxes (BoundingBox box1, BoundingBox box2) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Check_Collision_Boxes ( + Box_1 : Bounding_Box := No_Bounding_Box; + Box_2 : Bounding_Box := No_Bounding_Box + ) return Logical with + Import => True, + Convention => C, + External_Name => "CheckCollisionBoxes"; - --~function bool CheckCollisionBoxSphere (BoundingBox box, Vector3 center, float radius) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Check_Collision_Box_Sphere ( + Box : Bounding_Box := No_Bounding_Box; + Center : Vector_3D := (0.0, 0.0, 0.0); + Radius : Float := 0.0 + ) return Logical with + Import => True, + Convention => C, + External_Name => "CheckCollisionBoxSphere"; - --~function RayCollision GetRayCollisionSphere (Ray ray, Vector3 center, float radius) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Get_Ray_Collision_Sphere ( + Hit : Ray := No_Ray; + Center : Vector_3D := (0.0, 0.0, 0.0); + Radius : Float := 0.0 + ) return Ray_Collision with + Import => True, + Convention => C, + External_Name => "GetRayCollisionSphere"; - --~function RayCollision GetRayCollisionBox (Ray ray, BoundingBox box) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Get_Ray_Collision_Box ( + Hit : Ray := No_Ray; + Box : Bounding_Box := No_Bounding_Box + ) return Ray_Collision with + Import => True, + Convention => C, + External_Name => "GetRayCollisionBox"; - --~function RayCollision GetRayCollisionMesh (Ray ray, Mesh mesh, Matrix transform) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Get_Ray_Collision_Mesh ( + Hit : Ray := No_Ray; + Data : Mesh := No_Mesh; + Transform : Matrix_4D := Id_Matrix + ) return Ray_Collision with + Import => True, + Convention => C, + External_Name => "GetRayCollisionMesh"; - --~function RayCollision GetRayCollisionTriangle (Ray ray, Vector3 p1, Vector3 p2, Vector3 p3) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Get_Ray_Collision_Triangle ( + Hit : Ray := No_Ray; + Point_1 : Vector_3D := (0.0, 0.0, 0.0); + Point_2 : Vector_3D := (0.0, 0.0, 0.0); + Point_3 : Vector_3D := (0.0, 0.0, 0.0) + ) return Ray_Collision with + Import => True, + Convention => C, + External_Name => "GetRayCollisionTriangle"; - --~function RayCollision GetRayCollisionQuad (Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Get_Ray_Collision_Quad ( + Hit : Ray := No_Ray; + Point_1 : Vector_3D := (0.0, 0.0, 0.0); + Point_2 : Vector_3D := (0.0, 0.0, 0.0); + Point_3 : Vector_3D := (0.0, 0.0, 0.0); + Point_4 : Vector_3D := (0.0, 0.0, 0.0) + ) return Ray_Collision with + Import => True, + Convention => C, + External_Name => "GetRayCollisionQuad"; --~typedef void (*AudioCallback) (void *bufferData, unsigned int frames) with --~Import => True, @@ -3782,20 +3822,20 @@ package Raylib is Convention => C, External_Name => "CloseAudioDevice"; - --~function bool IsAudioDeviceReady (void) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Is_Audio_Device_Ready return Logical with + Import => True, + Convention => C, + External_Name => "IsAudioDeviceReady"; - --~procedure SetMasterVolume (float volume) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + procedure Set_Master_Volume (Volume : Float := 1.0) with + Import => True, + Convention => C, + External_Name => "SetMasterVolume"; - --~function float GetMasterVolume (void) with - --~Import => True, - --~Convention => C, - --~External_Name => ""; + function Get_Master_Volume return Float with + Import => True, + Convention => C, + External_Name => "GetMasterVolume"; --~function Wave LoadWave (const char *fileName) with --~Import => True,