Updated to avoid pointers
This commit is contained in:
parent
c9e30f7754
commit
af890cf210
1 changed files with 6 additions and 6 deletions
12
src/physac.h
12
src/physac.h
|
@ -66,13 +66,13 @@ typedef struct Collider {
|
||||||
int radius; // Used for COLLIDER_CIRCLE
|
int radius; // Used for COLLIDER_CIRCLE
|
||||||
} Collider;
|
} Collider;
|
||||||
|
|
||||||
typedef struct PhysicObject {
|
typedef struct PhysicObjectData {
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
Transform transform;
|
Transform transform;
|
||||||
Rigidbody rigidbody;
|
Rigidbody rigidbody;
|
||||||
Collider collider;
|
Collider collider;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
} PhysicObject;
|
} PhysicObjectData, *PhysicObject;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { // Prevents name mangling of functions
|
extern "C" { // Prevents name mangling of functions
|
||||||
|
@ -85,14 +85,14 @@ void InitPhysics(Vector2 gravity);
|
||||||
void UpdatePhysics(); // Update physic objects, calculating physic behaviours and collisions detection
|
void UpdatePhysics(); // Update physic objects, calculating physic behaviours and collisions detection
|
||||||
void ClosePhysics(); // Unitialize all physic objects and empty the objects pool
|
void ClosePhysics(); // Unitialize all physic objects and empty the objects pool
|
||||||
|
|
||||||
PhysicObject *CreatePhysicObject(Vector2 position, float rotation, Vector2 scale); // Create a new physic object dinamically, initialize it and add to pool
|
PhysicObject CreatePhysicObject(Vector2 position, float rotation, Vector2 scale); // Create a new physic object dinamically, initialize it and add to pool
|
||||||
void DestroyPhysicObject(PhysicObject *pObj); // Destroy a specific physic object and take it out of the list
|
void DestroyPhysicObject(PhysicObject pObj); // Destroy a specific physic object and take it out of the list
|
||||||
|
|
||||||
void ApplyForce(PhysicObject *pObj, Vector2 force); // Apply directional force to a physic object
|
void ApplyForce(PhysicObject pObj, Vector2 force); // Apply directional force to a physic object
|
||||||
void ApplyForceAtPosition(Vector2 position, float force, float radius); // Apply radial force to all physic objects in range
|
void ApplyForceAtPosition(Vector2 position, float force, float radius); // Apply radial force to all physic objects in range
|
||||||
|
|
||||||
Rectangle TransformToRectangle(Transform transform); // Convert Transform data type to Rectangle (position and scale)
|
Rectangle TransformToRectangle(Transform transform); // Convert Transform data type to Rectangle (position and scale)
|
||||||
void DrawPhysicObjectInfo(PhysicObject *pObj, Vector2 position, int fontSize); // Draw physic object information at screen position
|
void DrawPhysicObjectInfo(PhysicObject pObj, Vector2 position, int fontSize); // Draw physic object information at screen position
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue