mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
faster window startup by deferring postinit
...for real this time
This commit is contained in:
@@ -579,14 +579,16 @@ public class App implements ApplicationListener {
|
|||||||
private FrameBuffer postProcessorOutFBO;
|
private FrameBuffer postProcessorOutFBO;
|
||||||
private FrameBuffer postProcessorOutFBO2;
|
private FrameBuffer postProcessorOutFBO2;
|
||||||
|
|
||||||
@Override
|
private void firePostInit() {
|
||||||
public void render() {
|
|
||||||
// Gdx.gl.glDisable(GL20.GL_DITHER);
|
|
||||||
|
|
||||||
if (!postInitFired) {
|
if (!postInitFired) {
|
||||||
postInitFired = true;
|
postInitFired = true;
|
||||||
postInit();
|
postInit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
// Gdx.gl.glDisable(GL20.GL_DITHER);
|
||||||
|
|
||||||
App.setDebugTime("GDX.rawDelta", (long) (Gdx.graphics.getDeltaTime() * 1000_000_000f));
|
App.setDebugTime("GDX.rawDelta", (long) (Gdx.graphics.getDeltaTime() * 1000_000_000f));
|
||||||
|
|
||||||
@@ -605,6 +607,8 @@ public class App implements ApplicationListener {
|
|||||||
loadTimer += Gdx.graphics.getDeltaTime();
|
loadTimer += Gdx.graphics.getDeltaTime();
|
||||||
|
|
||||||
if (loadTimer >= showupTime) {
|
if (loadTimer >= showupTime) {
|
||||||
|
firePostInit();
|
||||||
|
|
||||||
// hand over the scene control to this single class; Terrarum must call
|
// hand over the scene control to this single class; Terrarum must call
|
||||||
// 'AppLoader.getINSTANCE().screen.render(delta)', this is not redundant at all!
|
// 'AppLoader.getINSTANCE().screen.render(delta)', this is not redundant at all!
|
||||||
|
|
||||||
@@ -624,10 +628,13 @@ public class App implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
// draw the screen
|
// draw the screen
|
||||||
else {
|
else {
|
||||||
|
firePostInit();
|
||||||
|
|
||||||
currentScreen.render(UPDATE_RATE);
|
currentScreen.render(UPDATE_RATE);
|
||||||
postProcessorOutFBO = TerrarumPostProcessor.INSTANCE.draw(camera.combined, renderFBO);
|
postProcessorOutFBO = TerrarumPostProcessor.INSTANCE.draw(camera.combined, renderFBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KeyToggler.INSTANCE.update(currentScreen instanceof TerrarumIngame);
|
KeyToggler.INSTANCE.update(currentScreen instanceof TerrarumIngame);
|
||||||
|
|
||||||
|
|
||||||
@@ -1030,6 +1037,9 @@ public class App implements ApplicationListener {
|
|||||||
* Init stuffs which needs GL context
|
* Init stuffs which needs GL context
|
||||||
*/
|
*/
|
||||||
private void postInit() {
|
private void postInit() {
|
||||||
|
long t1 = System.nanoTime();
|
||||||
|
|
||||||
|
|
||||||
CommonResourcePool.INSTANCE.addToLoadingList("blockmarkings_common", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16, 0, 0, 0, 0, false, false, false));
|
CommonResourcePool.INSTANCE.addToLoadingList("blockmarkings_common", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16, 0, 0, 0, 0, false, false, false));
|
||||||
CommonResourcePool.INSTANCE.addToLoadingList("blockmarking_actor", () -> new BlockMarkerActor());
|
CommonResourcePool.INSTANCE.addToLoadingList("blockmarking_actor", () -> new BlockMarkerActor());
|
||||||
CommonResourcePool.INSTANCE.addToLoadingList("loading_circle_64", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/loading_circle_64.tga"), 64, 64, 0, 0, 0, 0, false, false, false));
|
CommonResourcePool.INSTANCE.addToLoadingList("loading_circle_64", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/loading_circle_64.tga"), 64, 64, 0, 0, 0, 0, false, false, false));
|
||||||
@@ -1190,7 +1200,9 @@ public class App implements ApplicationListener {
|
|||||||
printdbg(this, "Has update: " + hasUpdate);
|
printdbg(this, "Has update: " + hasUpdate);
|
||||||
|
|
||||||
|
|
||||||
printdbg(this, "PostInit done");
|
long t2 = System.nanoTime();
|
||||||
|
double tms = (t2 - t1) / 1000000000.0;
|
||||||
|
printdbg(this, "PostInit done; took "+tms+" seconds");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user