Core Module Configuration
Add Pixscape Runtime to the core module and load a scene from exported Studio assets.
On this page
In core/build.gradle:
dependencies {
api "games.pixscape:pixscape-runtime:$pixscapeRuntimeVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion"
}
Replace the default LiftOff application with an ApplicationAdapter using PixscapeEngine.
The normal startup order is simple: create the engine, load the exported project, then load the scene you want to play.
public class Main extends ApplicationAdapter {
private PixscapeEngine engine;
@Override
public void create() {
engine = new PixscapeEngine();
FileHandle projectJson =
Gdx.files.internal(
PixscapeEngine.RUNTIME_DIR_NAME + "/project.json"
);
engine.loadProject(projectJson.parent().parent());
engine.loadScene("iso2");
}
@Override
public void render() {
engine.update(Gdx.graphics.getDeltaTime());
engine.render();
}
@Override
public void resize(int width, int height) {
engine.resize(width, height);
}
@Override
public void dispose() {
engine.dispose();
}
}
To automatically load currentSceneName, use:
engine.loadScene(null);
When loadScene(...) returns successfully, the scene is ready to use. For loading screens or HTML resources that still need network delivery, use progressive scene loading instead.
Optional engine settings
The default platform target is AUTO. If your application needs to select one explicitly, configure it before loadProject(...):
PixscapeEngine engine = new PixscapeEngine()
.setPlatformTarget(PlatformTarget.DESKTOP_GL30);
If your game already has a LibGDX AssetManager, Pixscape can share it. Configure that before project loading as well; see Using your own AssetManager.
Resources created later by gameplay code may need to be declared for the scene. See Runtime Availability.