|
16 | 16 | * If not defined, the library is in header only mode and can be included in other headers |
17 | 17 | * or source files without problems. But only ONE file should hold the implementation. |
18 | 18 | * |
19 | | -* #define PHYSAC_STATIC (defined by default) |
20 | | -* The generated implementation will stay private inside implementation file and all |
21 | | -* internal symbols and functions will only be visible inside that file. |
22 | | -* |
23 | 19 | * #define PHYSAC_DEBUG |
24 | 20 | * Show debug traces log messages about physic bodies creation/destruction, physic system errors, |
25 | | -* some calculations results and NULL reference exceptions |
26 | | -* |
27 | | -* #define PHYSAC_DEFINE_VECTOR2_TYPE |
28 | | -* Forces library to define struct Vector2 data type (float x; float y) |
| 21 | +* some calculations results and NULL reference exceptions. |
29 | 22 | * |
30 | 23 | * #define PHYSAC_AVOID_TIMMING_SYSTEM |
31 | 24 | * Disables internal timming system, used by UpdatePhysics() to launch timmed physic steps, |
@@ -141,28 +134,28 @@ typedef struct PhysicsManifoldData { |
141 | 134 | // Module Functions Declaration |
142 | 135 | //---------------------------------------------------------------------------------- |
143 | 136 | // Physics system management |
144 | | -extern /* Functions visible from other files*/ void InitPhysics(void); // Initializes physics system |
145 | | -extern /* Functions visible from other files*/ void UpdatePhysics(void); // Update physics system |
146 | | -extern /* Functions visible from other files*/ void ResetPhysics(void); // Reset physics system (global variables) |
147 | | -extern /* Functions visible from other files*/ void ClosePhysics(void); // Close physics system and unload used memory |
148 | | -extern /* Functions visible from other files*/ void SetPhysicsTimeStep(double delta); // Sets physics fixed time step in milliseconds. 1.666666 by default |
149 | | -extern /* Functions visible from other files*/ void SetPhysicsGravity(float x, float y); // Sets physics global gravity force |
| 137 | + void InitPhysics(void); // Initializes physics system |
| 138 | + void UpdatePhysics(void); // Update physics system |
| 139 | + void ResetPhysics(void); // Reset physics system (global variables) |
| 140 | + void ClosePhysics(void); // Close physics system and unload used memory |
| 141 | + void SetPhysicsTimeStep(double delta); // Sets physics fixed time step in milliseconds. 1.666666 by default |
| 142 | + void SetPhysicsGravity(float x, float y); // Sets physics global gravity force |
150 | 143 | // Physic body creation/destroy |
151 | | -extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyCircle(Vector2 pos, float radius, float density); // Creates a new circle physics body with generic parameters |
152 | | -extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density); // Creates a new rectangle physics body with generic parameters |
153 | | -extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density); // Creates a new polygon physics body with generic parameters |
154 | | -extern /* Functions visible from other files*/ void DestroyPhysicsBody(PhysicsBody body); // Destroy a physics body |
| 144 | + PhysicsBody CreatePhysicsBodyCircle(Vector2 pos, float radius, float density); // Creates a new circle physics body with generic parameters |
| 145 | + PhysicsBody CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density); // Creates a new rectangle physics body with generic parameters |
| 146 | + PhysicsBody CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density); // Creates a new polygon physics body with generic parameters |
| 147 | + void DestroyPhysicsBody(PhysicsBody body); // Destroy a physics body |
155 | 148 | // Physic body forces |
156 | | -extern /* Functions visible from other files*/ void PhysicsAddForce(PhysicsBody body, Vector2 force); // Adds a force to a physics body |
157 | | -extern /* Functions visible from other files*/ void PhysicsAddTorque(PhysicsBody body, float amount); // Adds an angular force to a physics body |
158 | | -extern /* Functions visible from other files*/ void PhysicsShatter(PhysicsBody body, Vector2 position, float force); // Shatters a polygon shape physics body to little physics bodies with explosion force |
159 | | -extern /* Functions visible from other files*/ void SetPhysicsBodyRotation(PhysicsBody body, float radians); // Sets physics body shape transform based on radians parameter |
| 149 | + void PhysicsAddForce(PhysicsBody body, Vector2 force); // Adds a force to a physics body |
| 150 | + void PhysicsAddTorque(PhysicsBody body, float amount); // Adds an angular force to a physics body |
| 151 | + void PhysicsShatter(PhysicsBody body, Vector2 position, float force); // Shatters a polygon shape physics body to little physics bodies with explosion force |
| 152 | + void SetPhysicsBodyRotation(PhysicsBody body, float radians); // Sets physics body shape transform based on radians parameter |
160 | 153 | // Query physics info |
161 | | -extern /* Functions visible from other files*/ PhysicsBody GetPhysicsBody(int index); // Returns a physics body of the bodies pool at a specific index |
162 | | -extern /* Functions visible from other files*/ int GetPhysicsBodiesCount(void); // Returns the current amount of created physics bodies |
163 | | -extern /* Functions visible from other files*/ int GetPhysicsShapeType(int index); // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON) |
164 | | -extern /* Functions visible from other files*/ int GetPhysicsShapeVerticesCount(int index); // Returns the amount of vertices of a physics body shape |
165 | | -extern /* Functions visible from other files*/ Vector2 GetPhysicsShapeVertex(PhysicsBody body, int vertex); // Returns transformed position of a body shape (body position + vertex transformed position) |
| 154 | + PhysicsBody GetPhysicsBody(int index); // Returns a physics body of the bodies pool at a specific index |
| 155 | + int GetPhysicsBodiesCount(void); // Returns the current amount of created physics bodies |
| 156 | + int GetPhysicsShapeType(int index); // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON) |
| 157 | + int GetPhysicsShapeVerticesCount(int index); // Returns the amount of vertices of a physics body shape |
| 158 | + Vector2 GetPhysicsShapeVertex(PhysicsBody body, int vertex); // Returns transformed position of a body shape (body position + vertex transformed position) |
166 | 159 | /*********************************************************************************** |
167 | 160 | * |
168 | 161 | * PHYSAC IMPLEMENTATION |
|
0 commit comments