@Override public final void write (Kryo kryo, Output output) { if (currentReadWriteVersion == -1) throw new RuntimeException("currentReadWriteVersion must be set before writing."); if (currentReadWriteVersion < 0 || minimumReadVersion < 0) throw new RuntimeException("currentReadWriteVersion and minimumReadVersion must not be less than 0."); if (currentReadWriteVersion < minimumReadVersion) throw new RuntimeException("currentReadWriteVersion cannot be lower than minimumReadVersion"); Class type = data == null ? null : data.getClass(); pushHeader(kryo, this); output.writeInt(GRAPH_HEADER_VERSION, true); kryo.writeClass(output, type); output.writeInt(Version.MAJOR, true); output.writeInt(Version.MINOR, true); output.writeInt(Version.REVISION, true); output.writeInt(currentReadWriteVersion, true); output.writeInt(minimumReadVersion, true); output.writeString(minimumReadVersionString); output.writeBoolean(useCompactColor); output.writeBoolean(includePixmapDrawingParams); writeExtra(kryo, output); if (data != null) kryo.writeObject(output, data); popHeader(kryo); }
/** * If reading an object graph that started with an instance of GraphHeader, serializers can call this in their * <code>read</code> methods to determine if the LibGDX version of the data being read is from a version of LibGDX * higher or equal to a given specific revision. * @param kryo The Kryo instance currently reading data. * @return Whether the LibGDX version used to write the data being read is higher than or equal to the given version. * If a GraphHeader did not precede the data being read, the currently used LibGDX version is assumed as the version * that wrote the data. */ public static boolean isWrittenGdxVersionAtLeast (Kryo kryo, int major, int minor, int revision) { GraphHeader graphHeader = peekHeader(kryo); if (graphHeader != null){ if (graphHeader.gdxMajorVersion != major) return graphHeader.gdxMajorVersion > major; if (graphHeader.gdxMinorVersion != minor) return graphHeader.gdxMinorVersion > minor; return graphHeader.gdxRevisionVersion >= revision; } return Version.isHigherEqual(major, minor, revision); }
@Override public void create() { _last_tick = System.currentTimeMillis(); _input = new Input(); Gdx.app.setLogLevel(Application.LOG_DEBUG); Gdx.input.setInputProcessor(_input); _log.debug("LibGDX ver: " + Version.VERSION); _log.debug("gl vendor: " + Gdx.gl.glGetString(GL20.GL_VENDOR)); _log.debug("gl ver: " + Gdx.gl.glGetString(GL20.GL_VERSION)); ResourceLoader.loadSystemFont(); GUIGDX.init(); Main.getAssetManager().load(RESOURCE_DIR + "core_skin.png", Texture.class); Main.getAssetManager().load(RESOURCE_DIR + "icons0.pack", TextureAtlas.class); Main.getAssetManager().finishLoading(); Skin_MyGUI skin = new Skin_MyGUI(); skin.Init(); skin.parseIcons(); Skin.setInstance(skin); this.setScreen(new ViewScreen()); }
private static void checkBeforeLoad () { if (skin != null) throw new GdxRuntimeException("VisUI cannot be loaded twice"); if (skipGdxVersionCheck == false && Version.VERSION.equals(TARGET_GDX_VERSION) == false) { Gdx.app.log("VisUI", "Warning, using invalid libGDX version for VisUI " + VERSION + ".\n" + "You are using libGDX " + Version.VERSION + " but you need " + TARGET_GDX_VERSION + ". This may cause " + "unexpected problems and runtime exceptions."); } }
public AboutDialog () { super("About"); setModal(true); addCloseButton(); closeOnEscape(); TableUtils.setSpacingDefaults(this); VisTable contentTable = new VisTable(false); contentTable.defaults().expand().left(); contentTable.add(new VisLabel("VisEditor - game level editor\nCopyright 2014-2016 Paweł Pastuszak\nLicensed under Apache2 license")).spaceBottom(8).row(); contentTable.add(new VisLabel("Farseer Physics Engine - polygon decomposition algorithms")).spaceBottom(8).row(); contentTable.add(new VisLabel("Thanks to all contributors and supporters,\nand thanks to you for using this software. <3", Align.center)).center().row(); VisTextButton okButton; VisTextButton openAppDirectoryButton; add(contentTable).pad(3).colspan(3).expand().fill().row(); VisLabel versionLabel = new VisLabel("Hover here to see\nlibraries versions", Align.center); new Tooltip.Builder("VisEditor " + App.VERSION + " \nBuild " + App.getBuildTimestamp() + "\nVisUI " + VisUI.VERSION + "\nLibGDX " + Version.VERSION, Align.left).target(versionLabel).build(); add(versionLabel).expandX().fillX(); add(openAppDirectoryButton = new VisTextButton("Open App Data Folder")); add(okButton = new VisTextButton("OK")).right(); openAppDirectoryButton.addListener(new VisChangeListener((event, actor) -> FileUtils.browse(FileUtils.toFileHandle(App.APP_FOLDER_PATH)))); okButton.addListener(new VisChangeListener((event, actor) -> fadeOut())); pack(); centerWindow(); }
@Override public void create() { // Load config projectConfig = Configs.loadCached(ProjectConfig.class); FTFGeneratorCache.getFTFGenerator(projectConfig.default_font); log.print("Onyx %s starting", projectConfig.version); log.print("Current libGDX version is %s", Version.VERSION); log.print("Current backend is %s/%s", Gdx.app.getType(), System.getProperty("os.name")); log.print("Current JRE version is %s", System.getProperty("java.version")); // Setup cameras OrthographicCamera worldCam = new OrthographicCamera(); worldCam.setToOrtho(false); worldCam.viewportWidth = Gdx.graphics.getWidth(); worldCam.viewportHeight = Gdx.graphics.getHeight(); OrthographicCamera guiCam = new OrthographicCamera(); guiCam.setToOrtho(false); guiCam.viewportWidth = Gdx.graphics.getWidth(); guiCam.viewportHeight = Gdx.graphics.getHeight(); // Setup GameManager GameManager.setWorldCamera(worldCam); GameManager.setGuiCamera(guiCam); GameManager.setRenderer(new ShapeRenderer()); GameManager.getRenderer().setAutoShapeType(true); GameManager.setBatch(new SpriteBatch()); GameManager.setFont(new BitmapFont()); // Init console Console.init(); // Init PolygonLoader PolygonLoader.init(); // Init KeymapLoader KeymapLoader.init(); // Setup Initial Screen Console.dispatchCommand("screen " + projectConfig.initial_screen); // Event handling OnyxEntityListener listener = new OnyxEntityListener(); EventManager.subscribe(listener); // Setup info component debugComponent = new TextComponent(""); }