diff --git a/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/TeaApplication.java b/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/TeaApplication.java index 25e00b8d..6b4ede32 100644 --- a/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/TeaApplication.java +++ b/backends/backend-teavm/src/main/java/com/github/xpenatan/gdx/backends/teavm/TeaApplication.java @@ -206,8 +206,6 @@ public void handleEvent(EventWrapper evt) { }); } - assetLoader.preload(config, "assets.txt"); - window.requestAnimationFrame(this); } @@ -218,10 +216,14 @@ public void run() { switch(state) { case INIT: if(delayInitCount == 0) { - initState = AppState.LOAD_ASSETS; + initState = AppState.PRELOAD_ASSETS; } break; - case LOAD_ASSETS: + case PRELOAD_ASSETS: + assetLoader.preload(config, "assets.txt"); + initState = AppState.DOWNLOAD_ASSETS; + break; + case DOWNLOAD_ASSETS: int queue = AssetDownloader.getInstance().getQueue(); if(queue == 0) { initState = AppState.APP_LOOP; @@ -469,7 +471,8 @@ public static boolean isMobileDevice () { public enum AppState { INIT, - LOAD_ASSETS, + PRELOAD_ASSETS, + DOWNLOAD_ASSETS, APP_CREATE, APP_LOOP }