Example usage for com.badlogic.gdx.utils.viewport ExtendViewport ExtendViewport

List of usage examples for com.badlogic.gdx.utils.viewport ExtendViewport ExtendViewport

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils.viewport ExtendViewport ExtendViewport.

Prototype

public ExtendViewport(float minWorldWidth, float minWorldHeight, float maxWorldWidth, float maxWorldHeight,
        Camera camera) 

Source Link

Document

Creates a new viewport with a maximum world size.

Usage

From source file:com.esotericsoftware.spine.superspineboy.View.java

License:Open Source License

View(Model model) {
    this.model = model;

    mapRenderer = new OrthoCachedTiledMapRenderer(model.map, scale, 3000);
    mapRenderer.setOverCache(0.6f);// ww w .ja v a2s  . co m
    mapRenderer.setMaxTileSize(512, 512);

    batch = new SpriteBatch();
    camera = new OrthographicCamera();
    viewport = new ExtendViewport(cameraMinWidth, cameraHeight, cameraMaxWidth, cameraHeight, camera);

    skeletonRenderer = new SkeletonRenderer();
    skeletonRenderer.setPremultipliedAlpha(true);

    assets = new Assets();

    ui = new UI(this);

    Gdx.input.setInputProcessor(new InputMultiplexer(ui, ui.stage, this));

    restart();
}

From source file:ca.hiphiparray.amazingmaze.MazeScreen.java

License:Open Source License

/**
 * Constructor for the maze screen.//  ww  w  . ja  va  2s. c  om
 *
 * @param game the {@link AmazingMazeGame} instance that is managing this screen.
 * @param help if this is the tutorial level.
 */
public MazeScreen(final AmazingMazeGame game, boolean help) {
    final int mapSize = 2;
    this.game = game;
    this.paused = false;
    this.help = help;

    this.mapWidth = 16 * mapSize + game.save.getLevel() * 5;
    this.mapHeight = 9 * mapSize;

    camera = new OrthographicCamera();
    camera.setToOrtho(false, 16 * mapSize, this.mapHeight);

    viewport = new ExtendViewport(0, this.mapHeight, this.mapWidth, this.mapHeight, camera);

    MapFactory factory;
    if (!help) {
        factory = new MapFactory(game, game.save.getLevel(), this.mapWidth, this.mapHeight, TILE_SIZE);
    } else {
        this.mapHeight = this.mapHeight * 5 / 8;
        factory = new MapFactory(game, -3, this.mapWidth, this.mapHeight, TILE_SIZE);
    }
    map = factory.generateMap();
    gateLocations = factory.getGateLocations();
    gateOn = factory.getGateOn();
    createBoundingBoxes();

    mapRenderer = new OrthogonalTiledMapRenderer(map, MAP_SCALE, game.batch);
    player = new Player(game.assets.manager.get(Assets.GAME_ATLAS_LOCATION, TextureAtlas.class)
            .findRegion(Assets.PLACEHOLDER), this);
    player.setScale(MAP_SCALE);

    if (!help) {
        setupHUD();
    }
    setupPauseMenu();
    input = new InputMultiplexer(pauseMenu, this);
}