diff options
3 files changed, 4 insertions, 5 deletions
diff --git a/core/src/main/java/coffee/liz/dyl/components/Velocity.java b/core/src/main/java/coffee/liz/dyl/components/Velocity.java index eb981f7..170fa84 100644 --- a/core/src/main/java/coffee/liz/dyl/components/Velocity.java +++ b/core/src/main/java/coffee/liz/dyl/components/Velocity.java @@ -12,5 +12,5 @@ import lombok.Setter; @Getter @Setter public class Velocity implements Component { - private Vector2 velocity = Vector2.Zero; + private Vector2 velocity = Vector2.Zero.cpy(); } diff --git a/core/src/main/java/coffee/liz/dyl/screen/GameScreen.java b/core/src/main/java/coffee/liz/dyl/screen/GameScreen.java index 54dfda3..39017c5 100644 --- a/core/src/main/java/coffee/liz/dyl/screen/GameScreen.java +++ b/core/src/main/java/coffee/liz/dyl/screen/GameScreen.java @@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class GameScreen implements Screen { + private static final float MAX_DELTA_SECONDS = 1 / 30f; private final DylGame game; private DylGameWorld dylGameWorld; @@ -25,7 +26,7 @@ public class GameScreen implements Screen { @Override public void render(final float delta) { - dylGameWorld.update(frameState, delta); + dylGameWorld.update(frameState, Math.min(delta, MAX_DELTA_SECONDS)); } @Override diff --git a/lwjgl3/src/main/java/coffee/liz/dyl/lwjgl3/Lwjgl3Launcher.java b/lwjgl3/src/main/java/coffee/liz/dyl/lwjgl3/Lwjgl3Launcher.java index 1902322..4aed564 100644 --- a/lwjgl3/src/main/java/coffee/liz/dyl/lwjgl3/Lwjgl3Launcher.java +++ b/lwjgl3/src/main/java/coffee/liz/dyl/lwjgl3/Lwjgl3Launcher.java @@ -21,9 +21,7 @@ public class Lwjgl3Launcher { //// Vsync limits the frames per second to what your hardware can display, and helps eliminate //// screen tearing. This setting doesn't always work on Linux, so the line after is a safeguard. configuration.useVsync(true); - //// Limits FPS to the refresh rate of the currently active monitor, plus 1 to try to match fractional - //// refresh rates. The Vsync setting above should limit the actual FPS to match the monitor. - configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate + 1); + configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate); //// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be //// useful for testing performance, but can also be very stressful to some hardware. //// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing. |
