v0.9.3: fixed waiting passing turns faster on high refresh rate displays
This commit is contained in:
parent
0c976729e0
commit
9c66287142
|
@ -589,6 +589,10 @@ public class GameScene extends PixelScene {
|
||||||
// We queue any removed element destruction, rather than destroying them in the actor thread.
|
// We queue any removed element destruction, rather than destroying them in the actor thread.
|
||||||
private ArrayList<Gizmo> toDestroy = new ArrayList<>();
|
private ArrayList<Gizmo> toDestroy = new ArrayList<>();
|
||||||
|
|
||||||
|
//the actor thread processes at a maximum of 60 times a second
|
||||||
|
//this caps the speed of resting for higher refresh rate displays
|
||||||
|
private float notifyDelay = 1/60f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void update() {
|
public synchronized void update() {
|
||||||
if (Dungeon.hero == null || scene == null) {
|
if (Dungeon.hero == null || scene == null) {
|
||||||
|
@ -597,6 +601,8 @@ public class GameScene extends PixelScene {
|
||||||
|
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
|
if (notifyDelay > 0) notifyDelay -= Game.elapsed;
|
||||||
|
|
||||||
if (!Emitter.freezeEmitters) water.offset( 0, -5 * Game.elapsed );
|
if (!Emitter.freezeEmitters) water.offset( 0, -5 * Game.elapsed );
|
||||||
|
|
||||||
if (!Actor.processing() && Dungeon.hero.isAlive()) {
|
if (!Actor.processing() && Dungeon.hero.isAlive()) {
|
||||||
|
@ -617,7 +623,8 @@ public class GameScene extends PixelScene {
|
||||||
Thread.currentThread().setName("SHPD Render Thread");
|
Thread.currentThread().setName("SHPD Render Thread");
|
||||||
Actor.keepActorThreadAlive = true;
|
Actor.keepActorThreadAlive = true;
|
||||||
actorThread.start();
|
actorThread.start();
|
||||||
} else {
|
} else if (notifyDelay <= 0f) {
|
||||||
|
notifyDelay += 1/60f;
|
||||||
synchronized (actorThread) {
|
synchronized (actorThread) {
|
||||||
actorThread.notify();
|
actorThread.notify();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user