Search in sources :

Example 1 with FitViewport

use of com.badlogic.gdx.utils.viewport.FitViewport in project libgdx by libgdx.

the class ViewportTest1 method getViewports.

public static Array<Viewport> getViewports(Camera camera) {
    int minWorldWidth = 640;
    int minWorldHeight = 480;
    int maxWorldWidth = 800;
    int maxWorldHeight = 480;
    Array<Viewport> viewports = new Array();
    viewports.add(new StretchViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new FillViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new FitViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, camera));
    viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, maxWorldWidth, maxWorldHeight, camera));
    viewports.add(new ScreenViewport(camera));
    ScreenViewport screenViewport = new ScreenViewport(camera);
    screenViewport.setUnitsPerPixel(0.75f);
    viewports.add(screenViewport);
    viewports.add(new ScalingViewport(Scaling.none, minWorldWidth, minWorldHeight, camera));
    return viewports;
}
Also used : Array(com.badlogic.gdx.utils.Array) FillViewport(com.badlogic.gdx.utils.viewport.FillViewport) ExtendViewport(com.badlogic.gdx.utils.viewport.ExtendViewport) StretchViewport(com.badlogic.gdx.utils.viewport.StretchViewport) ExtendViewport(com.badlogic.gdx.utils.viewport.ExtendViewport) ScalingViewport(com.badlogic.gdx.utils.viewport.ScalingViewport) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport) Viewport(com.badlogic.gdx.utils.viewport.Viewport) FillViewport(com.badlogic.gdx.utils.viewport.FillViewport) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) StretchViewport(com.badlogic.gdx.utils.viewport.StretchViewport) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport) ScalingViewport(com.badlogic.gdx.utils.viewport.ScalingViewport)

Example 2 with FitViewport

use of com.badlogic.gdx.utils.viewport.FitViewport in project Alkahest-Coffee by AlkahestDev.

the class fakeMainGame method create.

@Override
public void create() {
    viewport = new FitViewport(1080, 720, new PerspectiveCamera());
    batch = new SpriteBatch();
    img = new Texture("badAlkahest.png");
    // Creating the menu
    menu.create(MenuState.MAIN);
    Gdx.input.setInputProcessor(menu);
}
Also used : SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport)

Example 3 with FitViewport

use of com.badlogic.gdx.utils.viewport.FitViewport in project libgdx by libgdx.

the class TiledMapPackerTestRender method create.

@Override
public void create() {
    atlasTmxMapLoader = new AtlasTmxMapLoader(new InternalFileHandleResolver());
    params = new AtlasTmxMapLoader.AtlasTiledMapLoaderParameters();
    params.generateMipMaps = false;
    params.convertObjectToTileSpace = false;
    params.flipY = true;
    viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT);
    cam = (OrthographicCamera) viewport.getCamera();
    map = atlasTmxMapLoader.load(TMX_LOC, params);
    mapRenderer = new OrthogonalTiledMapRenderer(map, UNIT_SCALE);
}
Also used : OrthogonalTiledMapRenderer(com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer) InternalFileHandleResolver(com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver) AtlasTmxMapLoader(com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport)

Aggregations

FitViewport (com.badlogic.gdx.utils.viewport.FitViewport)3 InternalFileHandleResolver (com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1 AtlasTmxMapLoader (com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader)1 OrthogonalTiledMapRenderer (com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer)1 Array (com.badlogic.gdx.utils.Array)1 ExtendViewport (com.badlogic.gdx.utils.viewport.ExtendViewport)1 FillViewport (com.badlogic.gdx.utils.viewport.FillViewport)1 ScalingViewport (com.badlogic.gdx.utils.viewport.ScalingViewport)1 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)1 StretchViewport (com.badlogic.gdx.utils.viewport.StretchViewport)1 Viewport (com.badlogic.gdx.utils.viewport.Viewport)1