v3.0.0: fixed rare freezes with gamescene flashing

This commit is contained in:
Evan Debenham
2025-01-06 15:21:55 -05:00
parent e911070017
commit 367173a5c7

View File

@@ -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,6 +1356,10 @@ public class GameScene extends PixelScene {
public static void flash( int color, boolean lightmode ) {
if (scene != null) {
//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);
@@ -1362,6 +1367,8 @@ public class GameScene extends PixelScene {
scene.fadeIn(color, lightmode);
}
}
});
}
}
public static void gameOver() {