mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
game actually reads fps setting from config
This commit is contained in:
@@ -160,12 +160,12 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
LwjglApplicationConfiguration appConfig = new LwjglApplicationConfiguration();
|
||||
//appConfig.useGL30 = true; // used: loads GL 3.2, unused: loads GL 4.6; what the fuck?
|
||||
appConfig.vSyncEnabled = false;
|
||||
appConfig.vSyncEnabled = true;
|
||||
appConfig.resizable = false;//true;
|
||||
appConfig.width = 1110; // photographic ratio (1.5:1)
|
||||
appConfig.height = 740; // photographic ratio (1.5:1)
|
||||
appConfig.backgroundFPS = 9999;
|
||||
appConfig.foregroundFPS = 9999;
|
||||
appConfig.backgroundFPS = 0;
|
||||
appConfig.foregroundFPS = 0;
|
||||
appConfig.title = GAME_NAME;
|
||||
appConfig.forceExit = false;
|
||||
|
||||
@@ -207,7 +207,7 @@ public class AppLoader implements ApplicationListener {
|
||||
Gdx.gl20.glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
public static final double UPDATE_RATE = 1.0 / 61.0; // TODO set it like 1/100, because apparent framerate is limited by update rate
|
||||
public static final double UPDATE_RATE = 1.0 / 60.0; // TODO set it like 1/100, because apparent framerate is limited by update rate
|
||||
|
||||
private float loadTimer = 0f;
|
||||
private final float showupTime = 100f / 1000f;
|
||||
@@ -481,6 +481,11 @@ public class AppLoader implements ApplicationListener {
|
||||
createDirs();
|
||||
readConfigJson();
|
||||
|
||||
// set render configs according to local config
|
||||
appConfig.vSyncEnabled = getConfigBoolean("usevsync");
|
||||
appConfig.foregroundFPS = getConfigInt("displayfps");
|
||||
appConfig.backgroundFPS = getConfigInt("displayfps");
|
||||
|
||||
textureWhiteSquare = new Texture(Gdx.files.internal("assets/graphics/ortho_line_tex_2px.tga"));
|
||||
textureWhiteSquare.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ object DefaultConfig {
|
||||
val jsonObject = JsonObject()
|
||||
|
||||
jsonObject.addProperty("displayfps", 0) // 0: no limit, non-zero: limit
|
||||
jsonObject.addProperty("usevsync", true)
|
||||
jsonObject.addProperty("usevsync", false)
|
||||
jsonObject.addProperty("forcedevbuild", false)
|
||||
|
||||
|
||||
|
||||
@@ -198,12 +198,23 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
||||
|
||||
private val introUncoverTime: Second = 0.3f
|
||||
private var introUncoverDeltaCounter = 0f
|
||||
private var updateDeltaCounter = 0.0
|
||||
private var updateAkku = 0.0
|
||||
|
||||
override fun render(delta: Float) {
|
||||
// TODO async update
|
||||
// async update and render
|
||||
|
||||
val dt = AppLoader.getSmoothDelta()
|
||||
updateAkku += dt
|
||||
|
||||
var i = 0L
|
||||
while (updateAkku >= delta) {
|
||||
updateScreen(delta)
|
||||
updateAkku -= delta
|
||||
i += 1
|
||||
}
|
||||
AppLoader.debugTimers["Ingame.updateCounter"] = i
|
||||
|
||||
|
||||
updateScreen(delta)
|
||||
// render? just do it anyway
|
||||
renderScreen()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user