Moved imgui init into loading screen.

This commit is contained in:
Willem 2022-02-04 23:17:52 +01:00
parent 4baf14a0c3
commit 23dc554743
4 changed files with 68 additions and 20 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

View file

@ -28,6 +28,7 @@ import love.distributedrebirth.gdxapp.screen.ScreenDefault;
import love.distributedrebirth.gdxapp.screen.ScreenHelp;
import love.distributedrebirth.gdxapp.screen.ScreenIntro;
import love.distributedrebirth.gdxapp.screen.ScreenIntroMission;
import love.distributedrebirth.gdxapp.screen.ScreenLoading;
import love.distributedrebirth.gdxapp.screen.ScreenUnicode4D;
import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore;
import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
@ -37,6 +38,7 @@ import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
*/
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class Demo4DMain extends Game {
private int lazyIntCnt = 33;
private List<String> args;
public NativeFileChooser fileChooser;
public SpriteBatch batch;
@ -61,6 +63,32 @@ public class Demo4DMain extends Game {
this.fileChooser = fileChooser;
}
private void lazyInit() {
if (lazyIntCnt > 0) {
lazyIntCnt--;
return;
}
ImGuiSetup.init();
int fileArgu = args.indexOf("warpcore-load");
if (fileArgu != -1) {
// TODO: load warpcore
}
if (!args.contains("warpcore-nolock")) {
TOSWarpCore.INSTANCE.BãßLockWarpCipher();
}
if (args.contains("full-screen")) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
if (args.contains("no-intro")) {
selectScreen(ScreenDefault.class);
music.play(MusicSongType.BACKGROUND);
} else {
selectScreen(ScreenIntro.class);
}
}
public void create() {
batch = new SpriteBatch();
font = new BitmapFont();
@ -73,14 +101,15 @@ public class Demo4DMain extends Game {
music = new MusicManager();
music.init(args.contains("no-music"));
ImGuiSetup.init();
screens = new HashMap<>();
widgets = new HashMap<>();
putWidget(new MusicPlayerRenderer(this));
putWidget(new HebrewWalletRenderer(this));
putWidget(new BasePartRenderer(this));
putWidget(new BasicConsoleRenderer(this));
screens = new HashMap<>();
putScreen(new ScreenLoading(this));
putScreen(new ScreenIntro(this));
putScreen(new ScreenIntroMission(this));
putScreen(new ScreenDefault(this));
@ -89,22 +118,7 @@ public class Demo4DMain extends Game {
putScreen(new ScreenMatrix4D(this));
putScreen(new ScreenUnicode4D(this));
if (args.contains("no-intro")) {
selectScreen(ScreenDefault.class);
music.play(MusicSongType.BACKGROUND);
} else {
selectScreen(ScreenIntro.class);
}
if (args.contains("full-screen")) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
int fileArgu = args.indexOf("warpcore-load");
if (fileArgu != -1) {
// TODO: load warpcore
}
if (!args.contains("warpcore-nolock")) {
TOSWarpCore.INSTANCE.BãßLockWarpCipher();
}
selectScreen(ScreenLoading.class);
}
@Override
@ -137,6 +151,11 @@ public class Demo4DMain extends Game {
@Override
public void render() {
ScreenUtils.clear(0f, 0f, 0f, 1f, true);
if (screen instanceof ScreenLoading) {
screen.render(Gdx.graphics.getDeltaTime());
lazyInit();
return;
}
ImGuiSetup.imGuiImp.newFrame();
ImGui.newFrame();
if (hasMainMenu()) {

View file

@ -3,7 +3,6 @@ package love.distributedrebirth.gdxapp.screen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.utils.ScreenUtils;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp.Demo4DMain;
@ -20,7 +19,6 @@ public class ScreenDefault extends ScreenAdapter {
@Override
public void render(float delta) {
ScreenUtils.clear(0f, 0f, 0f, 1f);
main.batch.begin();
main.batch.draw(backgroundImage, 0, 0, main.viewWidth, main.viewHeight);
main.batch.end();

View file

@ -0,0 +1,31 @@
package love.distributedrebirth.gdxapp.screen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.Texture;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp.Demo4DMain;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenLoading extends ScreenAdapter {
private final Demo4DMain main;
private Texture backgroundImage;
public ScreenLoading(final Demo4DMain main) {
this.main = main;
backgroundImage = new Texture(Gdx.files.internal("background/gdxapp-loading.png"));
}
@Override
public void render(float delta) {
main.batch.begin();
main.batch.draw(backgroundImage, 0, 0, main.viewWidth, main.viewHeight);
main.batch.end();
}
@Override
public void dispose() {
backgroundImage.dispose();
}
}