use of gaiasky.GaiaSky in project gaiasky by langurmonkey.
the class GaiaSkyDesktop method runGaiaSky.
private void runGaiaSky(final Lwjgl3ApplicationConfiguration cfg) {
gs = new GaiaSky(gsArgs.skipWelcome, gsArgs.vr, gsArgs.externalView, gsArgs.headless, gsArgs.noScriptingServer, gsArgs.debug);
new Lwjgl3Application(gs, cfg);
}
use of gaiasky.GaiaSky in project gaiasky by langurmonkey.
the class WelcomeGui method initialize.
@Override
public void initialize(AssetManager assetManager, SpriteBatch sb) {
// User interface
ScreenViewport vp = new ScreenViewport();
vp.setUnitsPerPixel(unitsPerPixel);
ui = new Stage(vp, sb);
popupInterface = new PopupNotificationsInterface(skin);
popupInterface.top().right();
popupInterface.setFillParent(true);
if (vrStatus.vrInitFailed()) {
if (vrStatus.equals(VRStatus.ERROR_NO_CONTEXT))
GaiaSky.postRunnable(() -> GuiUtils.addNoVRConnectionExit(skin, ui));
else if (vrStatus.equals(VRStatus.ERROR_RENDERMODEL))
GaiaSky.postRunnable(() -> GuiUtils.addNoVRDataExit(skin, ui));
} else if (Settings.settings.program.net.slave.active || GaiaSky.instance.isHeadless()) {
// If slave or headless, data load can start
gaiaSky();
} else {
// Otherwise, check for updates, etc.
clearGui();
dataDescriptor = Gdx.files.absolute(SysUtils.getTempDir(Settings.settings.data.location) + "/gaiasky-data.json");
DownloadHelper.downloadFile(Settings.settings.program.url.dataDescriptor, dataDescriptor, null, null, (digest) -> GaiaSky.postRunnable(() -> {
// Data descriptor ok. Skip welcome screen only if flag and base data present
if (skipWelcome && baseDataPresent()) {
gaiaSky();
} else {
buildWelcomeUI();
}
}), () -> {
// Fail?
downloadError = true;
logger.error(I18n.txt("gui.welcome.error.nointernet"));
if (baseDataPresent()) {
// Go on all in
GaiaSky.postRunnable(() -> GuiUtils.addNoConnectionWindow(skin, ui, () -> buildWelcomeUI()));
} else {
// Error and exit
logger.error(I18n.txt("gui.welcome.error.nobasedata"));
GaiaSky.postRunnable(() -> GuiUtils.addNoConnectionExit(skin, ui));
}
}, null);
/* CAPTURE SCROLL FOCUS */
ui.addListener(event -> {
if (event instanceof InputEvent) {
InputEvent ie = (InputEvent) event;
if (ie.getType() == Type.keyUp) {
if (ie.getKeyCode() == Input.Keys.ESCAPE) {
Gdx.app.exit();
} else if (ie.getKeyCode() == Input.Keys.ENTER) {
if (baseDataPresent()) {
gaiaSky();
} else {
addDatasetManagerWindow(serverDatasets);
}
}
}
}
return false;
});
}
}
Aggregations