Example usage for com.badlogic.gdx.math Rectangle Rectangle

List of usage examples for com.badlogic.gdx.math Rectangle Rectangle

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Rectangle Rectangle.

Prototype

public Rectangle(float x, float y, float width, float height) 

Source Link

Document

Constructs a new rectangle with the given corner point in the bottom left and dimensions.

Usage

From source file:app.badlogicgames.splitpong.multiplayer.World.java

License:Apache License

public World() {
    pad = new Pad(new Vector2(MainMenuScreen.camX / 2, (int) MainMenuScreen.camY / 4 + 4));
    ball = new Ball(new Vector2(MainMenuScreen.camX / 2, MainMenuScreen.camY / 2));

    paredIzq = new Rectangle(0, MainMenuScreen.camY / 5, grosorPared, 4 * MainMenuScreen.camY / 5);
    paredDer = new Rectangle(MainMenuScreen.camX - grosorPared, MainMenuScreen.camY / 5, grosorPared,
            4 * MainMenuScreen.camY / 5);
    paredBot = new Rectangle(grosorPared, MainMenuScreen.camY / 5, MainMenuScreen.camX - 2 * grosorPared,
            grosorPared);//from ww  w . ja  v a  2  s .  c  o  m
    paredTop = new Rectangle(grosorPared, MainMenuScreen.camY - grosorPared,
            MainMenuScreen.camX - 2 * grosorPared, grosorPared);
}

From source file:app.badlogicgames.superjumper.GameObject.java

License:Apache License

public GameObject(float x, float y, float width, float height) {
    this.position = new Vector2(x, y);
    this.bounds = new Rectangle(x - width / 2, y - height / 2, width, height);
}

From source file:app.badlogicgames.superjumper.GameScreen.java

License:Apache License

public GameScreen(Game game) {
    this.game = game;

    state = GAME_READY;/*  w  ww  . j  a v a  2 s.  c  o m*/
    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    worldListener = new WorldListener() {
        @Override
        public void jump() {
            Assets.playSound(Assets.jumpSound);
        }

        @Override
        public void highJump() {
            Assets.playSound(Assets.highJumpSound);
        }

        @Override
        public void hit() {
            Assets.playSound(Assets.hitSound);
        }

        @Override
        public void coin() {
            Assets.playSound(Assets.coinSound);
        }
    };
    world = new World(worldListener);
    renderer = new WorldRenderer(batcher, world);
    pauseBounds = new Rectangle(320 - 64, 480 - 64, 64, 64);
    resumeBounds = new Rectangle(160 - 96, 240, 192, 36);
    quitBounds = new Rectangle(160 - 96, 240 - 36, 192, 36);
    lastScore = 0;
    scoreString = "SCORE: 0";
}

From source file:app.badlogicgames.superjumper.HelpScreen.java

License:Apache License

public HelpScreen(Game game) {
    this.game = game;

    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    nextBounds = new Rectangle(320 - 64, 0, 64, 64);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    helpImage = Assets.loadTexture("data/help1.png");
    helpRegion = new TextureRegion(helpImage, 0, 0, 320, 480);
}

From source file:app.badlogicgames.superjumper.HelpScreen2.java

License:Apache License

public HelpScreen2(Game game) {
    this.game = game;

    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    nextBounds = new Rectangle(320 - 64, 0, 64, 64);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    helpImage = Assets.loadTexture("data/help2.png");
    helpRegion = new TextureRegion(helpImage, 0, 0, 320, 480);
}

From source file:app.badlogicgames.superjumper.HelpScreen3.java

License:Apache License

public HelpScreen3(Game game) {
    this.game = game;

    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    nextBounds = new Rectangle(320 - 64, 0, 64, 64);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    helpImage = Assets.loadTexture("data/help3.png");
    helpRegion = new TextureRegion(helpImage, 0, 0, 320, 480);
}

From source file:app.badlogicgames.superjumper.HelpScreen4.java

License:Apache License

public HelpScreen4(Game game) {
    this.game = game;

    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    nextBounds = new Rectangle(320 - 64, 0, 64, 64);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    helpImage = Assets.loadTexture("data/help4.png");
    helpRegion = new TextureRegion(helpImage, 0, 0, 320, 480);
}

From source file:app.badlogicgames.superjumper.HelpScreen5.java

License:Apache License

public HelpScreen5(Game game) {
    this.game = game;

    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    nextBounds = new Rectangle(320 - 64, 0, 64, 64);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    helpImage = Assets.loadTexture("data/help5.png");
    helpRegion = new TextureRegion(helpImage, 0, 0, 320, 480);
}

From source file:app.badlogicgames.superjumper.HighscoresScreen.java

License:Apache License

public HighscoresScreen(Game game) {
    this.game = game;

    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    backBounds = new Rectangle(0, 0, 64, 64);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    highScores = new String[5];
    for (int i = 0; i < 5; i++) {
        highScores[i] = i + 1 + ". " + Settings.highscores[i];
        xOffset = Math.max(Assets.font.getBounds(highScores[i]).width, xOffset);
    }/*from  ww w  . j  ava 2  s  .c  om*/
    xOffset = 160 - xOffset / 2 + Assets.font.getSpaceWidth() / 2;
}

From source file:app.badlogicgames.superjumper.MainMenuScreen.java

License:Apache License

public MainMenuScreen(Game game) {
    this.game = game;

    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    batcher = new SpriteBatch();
    soundBounds = new Rectangle(0, 0, 64, 64);
    playBounds = new Rectangle(160 - 150, 200 + 18, 300, 36);
    highscoresBounds = new Rectangle(160 - 150, 200 - 18, 300, 36);
    helpBounds = new Rectangle(160 - 150, 200 - 18 - 36, 300, 36);
    multiplayerBounds = new Rectangle(160 - 64, 100, 128, 32);
    touchPoint = new Vector3();
}