From: NathanSweet Date: Sun, 6 Oct 2013 12:54:35 +0000 (+0200) Subject: Convenience methods so we don't have to set keepAspectRatio when using pixel coords. X-Git-Url: http://git.osdn.net/view?p=mikumikustudio%2Flibgdx-mikumikustudio.git;a=commitdiff_plain;h=0ec1cb62862c880fbb5e6c611f28ac46f12d97bb Convenience methods so we don't have to set keepAspectRatio when using pixel coords. --- diff --git a/gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java b/gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java index 8d60c4ae6..dc46f722b 100644 --- a/gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java +++ b/gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java @@ -82,6 +82,12 @@ public class Stage extends InputAdapter implements Disposable { this(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false, null); } + /** Creates a stage with the specified {@link #setViewport(float, float, boolean) viewport} that doesn't keep the aspect ratio. + * The stage will use its own {@link SpriteBatch}, which will be disposed when the stage is disposed. */ + public Stage (float width, float height) { + this(width, height, false, null); + } + /** Creates a stage with the specified {@link #setViewport(float, float, boolean) viewport}. The stage will use its own * {@link SpriteBatch}, which will be disposed when the stage is disposed. */ public Stage (float width, float height, boolean keepAspectRatio) { @@ -106,6 +112,12 @@ public class Stage extends InputAdapter implements Disposable { setViewport(width, height, keepAspectRatio); } + /** Sets up the stage size using a viewport that fills the entire screen without keeping the aspect ratio. + * @see #setViewport(float, float, boolean, float, float, float, float) */ + public void setViewport (float width, float height) { + setViewport(width, height, false, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + } + /** Sets up the stage size using a viewport that fills the entire screen. * @see #setViewport(float, float, boolean, float, float, float, float) */ public void setViewport (float width, float height, boolean keepAspectRatio) {