For IntelliJ IDEA and
Android Studio


@Override public void resize (int width, int height) { Gdx.input.setInputProcessor(new InputMultiplexer(ui, cameraInputController)); Gdx.gl.glViewport(0, 0, width, height); worldCamera.viewportWidth = width; worldCamera.viewportHeight = height; worldCamera.update(); ui.getViewport().setWorldSize(width, height); ui.getViewport().update(width, height, true); }
public void show() { if(initialized) { stage.getViewport().apply(true); stage.draw(); stage.act(); } } }
public void update(int width, int height, boolean centerCamera) { if(initialized) { stage.getViewport().update(width, height, centerCamera); } }
/** * Not a complete drawing solution; so much of the logic related to drawing is specific to each game, like * FOV being used to make certain things not render if they are out of sight, that this doesn't even try to * guess at what a particular game needs for its rendering code. You should probably draw any AnimatedEntity * objects, like what {@link SquidLayers#animateActor(int, int, char, Color)} returns, separately and after * calling this method. The recommended way to draw those objects is with {@link #drawEntity(AnimatedEntity)}, * which must be called between SpriteBatch's begin() and end() methods, while this method cannot be called * between those SpriteBatch methods. The solution, usually, is to call this method, then call * {@link SpriteBatch#begin()}, do any logic to determine what AnimatedEntity objects need to be shown (are * they in FOV, are they alive, etc.), draw the ones that should be shown with drawEntity(), and finally * call {@link SpriteBatch#end()} when no more AnimatedEntity objects need to be drawn. Note that this * method renders all of {@link #stage}, which may include other GUI elements using scene2d.ui, but the * AnimatedEntity objects in a SquidLayers aren't part of any Stage to allow them to be rendered as special * cases for visibility. * <br> * Specifically, this applies the current viewport to the stage, draws the stage, and makes any actions or * events related to the stage take effect. Should not be called inside a {@link SpriteBatch#begin()} block, * since this calls it itself by drawing the stage, and also calls {@link SpriteBatch#end()} afterwards. */ public void draw() { stage.getViewport().apply(true); stage.draw(); stage.act(); }