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. **/