Example usage for com.badlogic.gdx.graphics OrthographicCamera OrthographicCamera

List of usage examples for com.badlogic.gdx.graphics OrthographicCamera OrthographicCamera

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics OrthographicCamera OrthographicCamera.

Prototype

public OrthographicCamera(float viewportWidth, float viewportHeight) 

Source Link

Document

Constructs a new OrthographicCamera, using the given viewport width and height.

Usage

From source file:Tabox2D.java

License:Open Source License

private void adjustCamera() {
    float cameraW = width / meterSize;
    float cameraH = height / meterSize;
    camera = new OrthographicCamera(cameraW, cameraH);
    // Set at 0, 0, 0 in space:
    float camX = camera.viewportWidth / 2;
    float camY = camera.viewportHeight / 2;
    camera.position.set(camX, camY, 0f);
    camera.update();/* w  ww . j  ava  2  s.com*/
}

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

License:Apache License

public WorldRenderer(SpriteBatch batch, World world) {
    this.world = world;
    this.cam = new OrthographicCamera(MainMenuScreen.camX, MainMenuScreen.camY);
    this.cam.position.set(MainMenuScreen.camX / 2, MainMenuScreen.camY / 2, 0);
    this.batch = batch;
    enemyPlayer = new Player("ejemplo");
}

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

License:Apache License

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

    state = GAME_READY;//from  w  w w. 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   w  w  w .  j a va  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();
}