Skip to content

Commit

Permalink
debug: Add logging to AbstractAssetLoadingScreen.
Browse files Browse the repository at this point in the history
  • Loading branch information
crykn committed Dec 26, 2023
1 parent 8ed1bc9 commit 14b761b
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@

package de.eskalon.commons.screens;

import java.util.concurrent.TimeUnit;

import javax.annotation.Nullable;

import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.math.MathUtils;

import de.damios.guacamole.Stopwatch;
import de.damios.guacamole.annotations.GwtIncompatible;
import de.damios.guacamole.gdx.log.Logger;
import de.damios.guacamole.gdx.log.LoggerService;
Expand Down Expand Up @@ -53,6 +56,8 @@ public abstract class AbstractAssetLoadingScreen extends AbstractEskalonScreen {
private float progress;
private boolean isDone = false;

private Stopwatch stopwatch;

/**
* @param application
* @param packageRoot
Expand Down Expand Up @@ -88,6 +93,13 @@ public AbstractAssetLoadingScreen(AnnotationAssetManager assetManager,
this(assetManager, packageRoot, 30);
}

@Override
public void show() {
super.show();

stopwatch = Stopwatch.createStarted();
}

/**
* Loads the assets used in the loading screen itself.
*/
Expand All @@ -107,6 +119,8 @@ public void render(float delta) {
// Check if the asset manager is done
if (!isDone && assetManager.update(1000 / loadingTicksPerSecond)) {
isDone = true;
LOG.debug("Loading completed in %d miliseconds.",
stopwatch.getTime(TimeUnit.MILLISECONDS));
onFinishedLoading();
}

Expand Down

0 comments on commit 14b761b

Please sign in to comment.