From 502601e684676d474834ffb049e3691af7c88bf6 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Sun, 1 Jun 2025 23:17:23 +0000 Subject: [PATCH] moisesjpelaez - Add fixedUpdate for Physics --- leenkx/Sources/iron/Trait.hx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/leenkx/Sources/iron/Trait.hx b/leenkx/Sources/iron/Trait.hx index 854385d..dd63b00 100644 --- a/leenkx/Sources/iron/Trait.hx +++ b/leenkx/Sources/iron/Trait.hx @@ -16,6 +16,7 @@ class Trait { var _remove: ArrayVoid> = null; var _update: ArrayVoid> = null; var _lateUpdate: ArrayVoid> = null; + var _fixedUpdate: ArrayVoid> = null; var _render: ArrayVoid> = null; var _render2D: ArrayVoid> = null; @@ -87,6 +88,23 @@ class Trait { App.removeLateUpdate(f); } + /** + Add fixed game logic handler. + **/ + public function notifyOnFixedUpdate(f: Void->Void) { + if (_fixedUpdate == null) _fixedUpdate = []; + _fixedUpdate.push(f); + App.notifyOnFixedUpdate(f); + } + + /** + Remove fixed game logic handler. + **/ + public function removeFixedUpdate(f: Void->Void) { + _fixedUpdate.remove(f); + App.removeFixedUpdate(f); + } + /** Add render handler. **/