-
Notifications
You must be signed in to change notification settings - Fork 10
Remove usingnamespace, add new interface system, rework IDs, and misc fixes #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3b1f716
d1a3b3e
64f9ab9
f1546c6
8a65dbb
50e8a98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -292,9 +292,19 @@ typedef enum JPC_ShapeColor { | |||||||||||||||||
typedef uint16_t JPC_ObjectLayer; | ||||||||||||||||||
typedef uint8_t JPC_BroadPhaseLayer; | ||||||||||||||||||
|
||||||||||||||||||
typedef struct JPC_BodyID | ||||||||||||||||||
{ | ||||||||||||||||||
uint32_t id; | ||||||||||||||||||
} JPC_BodyID; | ||||||||||||||||||
|
||||||||||||||||||
typedef struct JPC_SubShapeID | ||||||||||||||||||
{ | ||||||||||||||||||
uint32_t id; | ||||||||||||||||||
} JPC_SubShapeID; | ||||||||||||||||||
|
||||||||||||||||||
#define JPC_ID_EQ(a, b) (a.id == b.id) | ||||||||||||||||||
|
||||||||||||||||||
Comment on lines
+305
to
+306
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The macro JPC_ID_EQ assumes both parameters have an 'id' field but lacks type safety. Consider using inline functions with proper parameter types to ensure type safety and provide better error messages when used incorrectly.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||
// TODO: Consider using structures for IDs | ||||||||||||||||||
hazeycode marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
typedef uint32_t JPC_BodyID; | ||||||||||||||||||
typedef uint32_t JPC_SubShapeID; | ||||||||||||||||||
typedef uint32_t JPC_CollisionGroupID; | ||||||||||||||||||
typedef uint32_t JPC_CollisionSubGroupID; | ||||||||||||||||||
|
||||||||||||||||||
|
@@ -985,8 +995,6 @@ typedef struct JPC_CharacterContactListenerVTable | |||||||||||||||||
|
||||||||||||||||||
typedef struct JPC_ContactListenerVTable | ||||||||||||||||||
{ | ||||||||||||||||||
hazeycode marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
_JPC_VTABLE_HEADER; | ||||||||||||||||||
|
||||||||||||||||||
// Optional, can be NULL. | ||||||||||||||||||
JPC_ValidateResult | ||||||||||||||||||
(*OnContactValidate)(void *in_self, | ||||||||||||||||||
|
@@ -1050,7 +1058,7 @@ typedef struct JPC_DebugRendererVTable | |||||||||||||||||
|
||||||||||||||||||
// Optional | ||||||||||||||||||
void | ||||||||||||||||||
(*DestroyTriangleBatch)(void *in_self, const void *in_primitive); | ||||||||||||||||||
(*DestroyTriangleBatch)(void *in_self, void *in_primitive); | ||||||||||||||||||
hazeycode marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
||||||||||||||||||
// Required, *cannot* be NULL. | ||||||||||||||||||
void | ||||||||||||||||||
|
@@ -1384,9 +1392,9 @@ JPC_PhysicsSystem_GetActiveBodyIDs(const JPC_PhysicsSystem *in_physics_system, | |||||||||||||||||
/// Access a body, will return NULL if the body ID is no longer valid. | ||||||||||||||||||
/// Use `JPC_PhysicsSystem_GetBodiesUnsafe()` to get an array of all body pointers. | ||||||||||||||||||
#define JPC_TRY_GET_BODY(all_body_ptrs, body_id) \ | ||||||||||||||||||
JPC_IS_VALID_BODY_POINTER(all_body_ptrs[body_id & JPC_BODY_ID_INDEX_BITS]) && \ | ||||||||||||||||||
all_body_ptrs[body_id & JPC_BODY_ID_INDEX_BITS]->id == body_id ? \ | ||||||||||||||||||
all_body_ptrs[body_id & JPC_BODY_ID_INDEX_BITS] : NULL | ||||||||||||||||||
JPC_IS_VALID_BODY_POINTER(all_body_ptrs[body_id.id & JPC_BODY_ID_INDEX_BITS]) && \ | ||||||||||||||||||
all_body_ptrs[body_id.id & JPC_BODY_ID_INDEX_BITS]->id.id == body_id.id ? \ | ||||||||||||||||||
all_body_ptrs[body_id.id & JPC_BODY_ID_INDEX_BITS] : NULL | ||||||||||||||||||
|
||||||||||||||||||
/// Get direct access to all bodies. Not protected by a lock. Use with great care! | ||||||||||||||||||
JPC_API JPC_Body ** | ||||||||||||||||||
|
@@ -2062,9 +2070,15 @@ JPC_BodyInterface_SetRotation(JPC_BodyInterface *in_iface, | |||||||||||||||||
JPC_API void | ||||||||||||||||||
JPC_BodyInterface_ActivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); | ||||||||||||||||||
|
||||||||||||||||||
JPC_API void | ||||||||||||||||||
JPC_BodyInterface_ActivateBodies(JPC_BodyInterface *in_iface, const JPC_BodyID* in_body_ids, int in_num_bodies); | ||||||||||||||||||
|
||||||||||||||||||
JPC_API void | ||||||||||||||||||
JPC_BodyInterface_DeactivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); | ||||||||||||||||||
|
||||||||||||||||||
JPC_API void | ||||||||||||||||||
JPC_BodyInterface_DeactivateBodies(JPC_BodyInterface *in_iface, const JPC_BodyID* in_body_ids, int in_num_bodies); | ||||||||||||||||||
|
||||||||||||||||||
JPC_API bool | ||||||||||||||||||
JPC_BodyInterface_IsActive(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); | ||||||||||||||||||
|
||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.