diff options
author | Ricardo Buring <ricardo.buring@gmail.com> | 2022-09-15 14:15:39 +0200 |
---|---|---|
committer | Ricardo Buring <ricardo.buring@gmail.com> | 2022-09-15 15:09:23 +0200 |
commit | ff4e72a0bcf8ee1b8db2cb492397866559d17a73 (patch) | |
tree | 93f66050a4a2dac4a20943fdf94db068a63b433d /servers/extensions/physics_server_3d_extension.h | |
parent | 4ba934bf3d1e697d8f332b5e8cfd694cdf49a7ba (diff) |
PhysicsServer2D and PhysicsServer3D: make body_set_state_sync_callback take a Callable
Prefer Callable to a C-style callback. This is helpful for GDExtension.
Diffstat (limited to 'servers/extensions/physics_server_3d_extension.h')
-rw-r--r-- | servers/extensions/physics_server_3d_extension.h | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/servers/extensions/physics_server_3d_extension.h b/servers/extensions/physics_server_3d_extension.h index b6ed346a3d..f1e522aca8 100644 --- a/servers/extensions/physics_server_3d_extension.h +++ b/servers/extensions/physics_server_3d_extension.h @@ -192,14 +192,8 @@ public: typedef PhysicsServer3D::MotionCollision PhysicsServer3DExtensionMotionCollision; typedef PhysicsServer3D::MotionResult PhysicsServer3DExtensionMotionResult; -struct PhysicsServer3DExtensionStateCallback { - void *instance = nullptr; - void (*callback)(void *p_instance, PhysicsDirectBodyState3D *p_state); -}; - GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionMotionCollision) GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionMotionResult) -GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionStateCallback) class PhysicsServer3DExtension : public PhysicsServer3D { GDCLASS(PhysicsServer3DExtension, PhysicsServer3D); @@ -380,13 +374,7 @@ public: EXBIND2(body_set_omit_force_integration, RID, bool) EXBIND1RC(bool, body_is_omitting_force_integration, RID) - GDVIRTUAL2(_body_set_state_sync_callback, RID, GDNativePtr<PhysicsServer3DExtensionStateCallback>) - void body_set_state_sync_callback(RID p_body, void *p_instance, BodyStateCallback p_callback) override { - PhysicsServer3DExtensionStateCallback callback; - callback.callback = p_callback; - callback.instance = p_instance; - GDVIRTUAL_REQUIRED_CALL(_body_set_state_sync_callback, p_body, &callback); - } + EXBIND2(body_set_state_sync_callback, RID, const Callable &) EXBIND3(body_set_force_integration_callback, RID, const Callable &, const Variant &) EXBIND2(body_set_ray_pickable, RID, bool) |