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/physics_2d/godot_body_2d.h | |
parent | 4ba934bf3d1e697d8f332b5e8cfd694cdf49a7ba (diff) | |
download | redot-engine-ff4e72a0bcf8ee1b8db2cb492397866559d17a73.tar.gz |
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/physics_2d/godot_body_2d.h')
-rw-r--r-- | servers/physics_2d/godot_body_2d.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/servers/physics_2d/godot_body_2d.h b/servers/physics_2d/godot_body_2d.h index 409940d4f8..86d42ae7f8 100644 --- a/servers/physics_2d/godot_body_2d.h +++ b/servers/physics_2d/godot_body_2d.h @@ -137,8 +137,7 @@ class GodotBody2D : public GodotCollisionObject2D { Vector<Contact> contacts; //no contacts by default int contact_count = 0; - void *body_state_callback_instance = nullptr; - PhysicsServer2D::BodyStateCallback body_state_callback = nullptr; + Callable body_state_callback; struct ForceIntegrationCallbackData { Callable callable; @@ -156,7 +155,7 @@ class GodotBody2D : public GodotCollisionObject2D { friend class GodotPhysicsDirectBodyState2D; // i give up, too many functions to expose public: - void set_state_sync_callback(void *p_instance, PhysicsServer2D::BodyStateCallback p_callback); + void set_state_sync_callback(const Callable &p_callable); void set_force_integration_callback(const Callable &p_callable, const Variant &p_udata = Variant()); GodotPhysicsDirectBodyState2D *get_direct_state(); |