From ea12d5b95141d54c6b054ad69dfc59c6fef01c9d Mon Sep 17 00:00:00 2001 From: Onek8 Date: Mon, 2 Jun 2025 16:21:25 +0000 Subject: [PATCH 1/3] moisesjpelaez - Fix pausing and resuming updates --- leenkx/Sources/iron/App.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leenkx/Sources/iron/App.hx b/leenkx/Sources/iron/App.hx index 676932c..1141187 100644 --- a/leenkx/Sources/iron/App.hx +++ b/leenkx/Sources/iron/App.hx @@ -52,9 +52,9 @@ class App { static function update() { if (Scene.active == null || !Scene.active.ready) return; - if (pauseUpdates) return; iron.system.Time.update(); + if (pauseUpdates) return; #if lnx_debug startTime = kha.Scheduler.realTime(); From 7f5786d47c5f18df470a8ec616cfd8eb8a9a7be9 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Mon, 2 Jun 2025 16:24:22 +0000 Subject: [PATCH 2/3] moisesjpelaez - Fix pausing and resuming updates --- leenkx/Sources/iron/object/ParticleSystem.hx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/leenkx/Sources/iron/object/ParticleSystem.hx b/leenkx/Sources/iron/object/ParticleSystem.hx index baeabac..a6b03da 100644 --- a/leenkx/Sources/iron/object/ParticleSystem.hx +++ b/leenkx/Sources/iron/object/ParticleSystem.hx @@ -22,10 +22,10 @@ class ParticleSystem { var ready: Bool; var frameRate = 24; var lifetime = 0.0; + var looptime = 0.0; var animtime = 0.0; var time = 0.0; var spawnRate = 0.0; - var looptime = 0.0; var seed = 0; var r: TParticleData; @@ -124,7 +124,8 @@ class ParticleSystem { public function update(object: MeshObject, owner: MeshObject) { if (!ready || object == null || speed == 0.0) return; - + if (iron.App.pauseUpdates) return; + var prevLap = lap; // Copy owner world transform but discard scale From ae91f8801fad533123b3e3d2c1449e456f2eb2bf Mon Sep 17 00:00:00 2001 From: Onek8 Date: Mon, 2 Jun 2025 16:32:28 +0000 Subject: [PATCH 3/3] moisesjpelaez - Fix pausing and resuming updates --- leenkx/Sources/iron/system/Time.hx | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/leenkx/Sources/iron/system/Time.hx b/leenkx/Sources/iron/system/Time.hx index 99484eb..1ebc077 100644 --- a/leenkx/Sources/iron/system/Time.hx +++ b/leenkx/Sources/iron/system/Time.hx @@ -1,7 +1,13 @@ package iron.system; class Time { - + public static var scale = 1.0; + + static var frequency: Null = null; + static function initFrequency() { + frequency = kha.Display.primary != null ? kha.Display.primary.frequency : 60; + } + public static var step(get, never): Float; static function get_step(): Float { if (frequency == null) initFrequency(); @@ -14,37 +20,39 @@ class Time { return _fixedStep; } - public static function initFixedStep(value: Float = 1 / 60) { _fixedStep = value; } - static var lastTime = 0.0; - public static var delta = 0.0; - + static var _delta = 0.0; + public static var delta(get, never): Float; + static function get_delta(): Float { + return _delta; + } + static var lastRenderTime = 0.0; - public static var renderDelta = 0.0; + static var _renderDelta = 0.0; + public static var renderDelta(get, never): Float; + static function get_renderDelta(): Float { + return _renderDelta; + } + public static inline function time(): Float { return kha.Scheduler.time(); } + public static inline function realTime(): Float { return kha.Scheduler.realTime(); } - static var frequency: Null = null; - - static function initFrequency() { - frequency = kha.Display.primary != null ? kha.Display.primary.frequency : 60; - } - public static function update() { - delta = (realTime() - lastTime) * scale; + _delta = realTime() - lastTime; lastTime = realTime(); } public static function render() { - renderDelta = (realTime() - lastRenderTime) * scale; + _renderDelta = realTime() - lastRenderTime; lastRenderTime = realTime(); } }