From 367173a5c719bf8de355569682f74a011f066bbf Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 6 Jan 2025 15:21:55 -0500 Subject: [PATCH] v3.0.0: fixed rare freezes with gamescene flashing --- .../scenes/GameScene.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 8a8fed9ea..497719af6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -137,6 +137,7 @@ import com.watabou.noosa.Visual; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.tweeners.Tweener; +import com.watabou.utils.Callback; import com.watabou.utils.DeviceCompat; import com.watabou.utils.GameMath; import com.watabou.utils.Point; @@ -1355,12 +1356,18 @@ public class GameScene extends PixelScene { public static void flash( int color, boolean lightmode ) { if (scene != null) { - //greater than 0 to account for negative values (which have the first bit set to 1) - if (color > 0 && color < 0x01000000) { - scene.fadeIn(0xFF000000 | color, lightmode); - } else { - scene.fadeIn(color, lightmode); - } + //don't want to do this on the actor thread + ShatteredPixelDungeon.runOnRenderThread(new Callback() { + @Override + public void call() { + //greater than 0 to account for negative values (which have the first bit set to 1) + if (color > 0 && color < 0x01000000) { + scene.fadeIn(0xFF000000 | color, lightmode); + } else { + scene.fadeIn(color, lightmode); + } + } + }); } }