OSDN Git Service

Convenience methods so we don't have to set keepAspectRatio when using pixel coords.
authorNathanSweet <nathan.sweet@gmail.com>
Sun, 6 Oct 2013 12:54:35 +0000 (14:54 +0200)
committerNathanSweet <nathan.sweet@gmail.com>
Sun, 6 Oct 2013 12:54:35 +0000 (14:54 +0200)
gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java

index 8d60c4a..dc46f72 100644 (file)
@@ -82,6 +82,12 @@ public class Stage extends InputAdapter implements Disposable {
                this(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false, null);\r
        }\r
 \r
+       /** Creates a stage with the specified {@link #setViewport(float, float, boolean) viewport} that doesn't keep the aspect ratio.\r
+        * The stage will use its own {@link SpriteBatch}, which will be disposed when the stage is disposed. */\r
+       public Stage (float width, float height) {\r
+               this(width, height, false, null);\r
+       }\r
+\r
        /** Creates a stage with the specified {@link #setViewport(float, float, boolean) viewport}. The stage will use its own\r
         * {@link SpriteBatch}, which will be disposed when the stage is disposed. */\r
        public Stage (float width, float height, boolean keepAspectRatio) {\r
@@ -106,6 +112,12 @@ public class Stage extends InputAdapter implements Disposable {
                setViewport(width, height, keepAspectRatio);\r
        }\r
 \r
+       /** Sets up the stage size using a viewport that fills the entire screen without keeping the aspect ratio.\r
+        * @see #setViewport(float, float, boolean, float, float, float, float) */\r
+       public void setViewport (float width, float height) {\r
+               setViewport(width, height, false, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());\r
+       }\r
+\r
        /** Sets up the stage size using a viewport that fills the entire screen.\r
         * @see #setViewport(float, float, boolean, float, float, float, float) */\r
        public void setViewport (float width, float height, boolean keepAspectRatio) {\r