Bug 20: Fixed the html module - GwtLauncher. Initialization of the Pixel Backend was at the wrong place

This commit is contained in:
Robert Vokac 2024-09-15 20:03:30 +02:00
parent 3bc112c17d
commit 98217661b8
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB

View File

@ -4,8 +4,6 @@ import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication; import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.openeggbert.core.configuration.ScreenResolution; import com.openeggbert.core.configuration.ScreenResolution;
import com.openeggbert.core.main.OpenEggbertGame;
import com.badlogic.gdx.ai.GdxLogger;
import com.openeggbert.core.main.OpenEggbertApplication; import com.openeggbert.core.main.OpenEggbertApplication;
import com.pixelgamelibrary.api.Pixel; import com.pixelgamelibrary.api.Pixel;
import com.pixelgamelibrary.backend.libgdx.PixelBackendLibGDX; import com.pixelgamelibrary.backend.libgdx.PixelBackendLibGDX;
@ -22,12 +20,13 @@ public class GwtLauncher extends GwtApplication {
//return cfg; //return cfg;
// If you want a fixed size application, comment out the above resizable section, // If you want a fixed size application, comment out the above resizable section,
// and uncomment below: // and uncomment below:
Pixel.initBackend(new PixelBackendLibGDX());
return new GwtApplicationConfiguration(ScreenResolution.VGA.getWidth(), ScreenResolution.VGA.getHeight()); return new GwtApplicationConfiguration(ScreenResolution.VGA.getWidth(), ScreenResolution.VGA.getHeight());
} }
@Override @Override
public ApplicationListener createApplicationListener () { public ApplicationListener createApplicationListener () {
if(!Pixel.isBackendSet()) {Pixel.initBackend(new PixelBackendLibGDX());}
return new LibGdxGame(new OpenEggbertApplication().createGame()); return new LibGdxGame(new OpenEggbertApplication().createGame());
} }
} }