Skip to content
Snippets Groups Projects
Commit 3173ccf7 authored by Drahomír Karchňák's avatar Drahomír Karchňák
Browse files

#599 Fixed a glithc which caused game to crash when loading common game page assets...

parent 35db42d9
Branches
Tags
No related merge requests found
......@@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaApplication;
......@@ -18,6 +19,7 @@ import cz.nic.tablexia.loader.TablexiaAbstractFileManager;
import cz.nic.tablexia.loader.TablexiaAtlasManager;
import cz.nic.tablexia.loader.TablexiaSoundManager;
import cz.nic.tablexia.screen.AbstractTablexiaScreen;
import cz.nic.tablexia.util.Log;
import cz.nic.tablexia.util.Utility;
public class GamePageScreen extends AbstractTablexiaScreen<GamePageScreen.GamePageCommonAssetManager> {
......@@ -36,14 +38,24 @@ public class GamePageScreen extends AbstractTablexiaScreen<GamePageScreen.GamePa
}
public void load() {
final CountDownLatch countDownLatch = new CountDownLatch(1);
//LibGDX is creating textures while loading atlases, that's why we need to run this on main thread, which has an opengl context...
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
loadCommonGamePageAtlas();
loadCommonGamePageSounds();
countDownLatch.countDown();
}
});
loadCommonGamePageSounds();
try {
countDownLatch.await();
} catch (InterruptedException e) {
Log.err(getClass(), "Cannot wait for loading common game page assets!", e);
}
}
public void dispose() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment