Skip to content

Commit

Permalink
Merge pull request #42 from jpooleycodes/runtime-mundus-refactor
Browse files Browse the repository at this point in the history
Refactored runtime's Mundus
  • Loading branch information
JamesTKhan authored May 20, 2022
2 parents 285da7b + f4a4f8d commit e28535e
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions gdx-runtime/src/com/mbrlabs/mundus/runtime/Mundus.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.utils.Disposable;
import com.mbrlabs.mundus.commons.Scene;
import com.mbrlabs.mundus.commons.assets.AssetManager;
import com.mbrlabs.mundus.commons.shaders.ModelShader;

/**
* @author Marcus Brummer
Expand All @@ -42,15 +44,8 @@ public Mundus(final FileHandle mundusRoot) {
this.root = mundusRoot;
this.assetManager = new AssetManager(root.child(PROJECT_ASSETS_DIR));
this.sceneLoader = new SceneLoader(this, root.child(PROJECT_SCENES_DIR));
}

public void init() {
try {
assetManager.loadAssets(null, true);
shaders = new Shaders();
} catch (Exception e) {
Gdx.app.log(TAG, e.getMessage());
}
init();
}

public AssetManager getAssetManager() {
Expand All @@ -61,13 +56,25 @@ public Shaders getShaders() {
return shaders;
}

public Scene loadScene(final String name) {
return sceneLoader.load(name);
public Scene loadScene(final String name, final ModelBatch batch) {
final Scene scene = sceneLoader.load(name);
scene.batch = batch;

return scene;
}

@Override
public void dispose() {
assetManager.dispose();
}

private void init() {
try {
assetManager.loadAssets(null, true);
shaders = new Shaders();
} catch (Exception e) {
Gdx.app.log(TAG, e.getMessage());
}
}

}

0 comments on commit e28535e

Please sign in to comment.