Search in sources :

Example 1 with ExtendViewport

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

the class CpuSpriteBatchTest method create.

public void create() {
    Batch batch = new CpuSpriteBatch();
    // batch = new SpriteBatch();
    stage = new Stage(new ExtendViewport(500, 500), batch);
    Gdx.input.setInputProcessor(stage);
    texture = new Texture("data/bobargb8888-32x32.png");
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    TextureRegionDrawable drawable = new TextureRegionDrawable(new TextureRegion(texture));
    for (int i = 0; i < NUM_GROUPS; i++) {
        Group group = createActorGroup(drawable);
        stage.addActor(group);
    }
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Group(com.badlogic.gdx.scenes.scene2d.Group) ExtendViewport(com.badlogic.gdx.utils.viewport.ExtendViewport) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) Batch(com.badlogic.gdx.graphics.g2d.Batch) CpuSpriteBatch(com.badlogic.gdx.graphics.g2d.CpuSpriteBatch) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) CpuSpriteBatch(com.badlogic.gdx.graphics.g2d.CpuSpriteBatch) Texture(com.badlogic.gdx.graphics.Texture)

Example 2 with ExtendViewport

use of com.badlogic.gdx.utils.viewport.ExtendViewport 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 3 with ExtendViewport

use of com.badlogic.gdx.utils.viewport.ExtendViewport in project jbump by implicit-invocation.

the class TestBump method create.

@Override
public void create() {
    spriteBatch = new SpriteBatch();
    // Create a TextureRegion containing a single, white pixel to enable rendering with ShapeDrawer.
    Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.drawPixel(0, 0);
    texture = new Texture(pixmap);
    pixmap.dispose();
    TextureRegion textureRegion = new TextureRegion(texture, 0, 0, 1, 1);
    shapeDrawer = new ShapeDrawer(spriteBatch, textureRegion);
    camera = new OrthographicCamera();
    gameViewport = new ExtendViewport(10, 10, camera);
    uiViewport = new ScreenViewport();
    shapeDrawer.update();
    font = new BitmapFont();
    mode = POINT;
    world = new World<Entity>(1f);
    entities = new Array<Entity>();
    String[] lines = MAP.split("\n");
    for (int j = 0; j < lines.length; j++) {
        String line = lines[j];
        for (int i = 0; i < line.length(); i++) {
            if (line.charAt(i) == '+') {
                entities.add(new WallEntity(i, lines.length - j));
            } else if (line.charAt(i) == 'p') {
                entities.add(new PlayerEntity(i, lines.length - j));
            }
        }
    }
}
Also used : ExtendViewport(com.badlogic.gdx.utils.viewport.ExtendViewport) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ShapeDrawer(space.earlygrey.shapedrawer.ShapeDrawer) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont)

Example 4 with ExtendViewport

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

the class ParticleEmittersTest method setupUI.

private void setupUI() {
    ui = new Stage(new ExtendViewport(640, 480));
    Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    skipCleanup = new CheckBox("Skip blend function clean-up", skin);
    skipCleanup.setTransform(false);
    skipCleanup.addListener(listener);
    logLabel = new Label("", skin.get(LabelStyle.class));
    clearEmitters = new TextButton("Clear screen", skin);
    clearEmitters.setTransform(false);
    clearEmitters.addListener(listener);
    Table table = new Table();
    table.setTransform(false);
    table.setFillParent(true);
    table.defaults().padTop(5).left();
    table.top().left().padLeft(5);
    table.add(skipCleanup).row();
    table.add(clearEmitters).row();
    table.add(logLabel);
    ui.addActor(table);
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) ExtendViewport(com.badlogic.gdx.utils.viewport.ExtendViewport) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin)

Aggregations

ExtendViewport (com.badlogic.gdx.utils.viewport.ExtendViewport)4 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)2 Stage (com.badlogic.gdx.scenes.scene2d.Stage)2 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)2 Texture (com.badlogic.gdx.graphics.Texture)1 Batch (com.badlogic.gdx.graphics.g2d.Batch)1 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)1 CpuSpriteBatch (com.badlogic.gdx.graphics.g2d.CpuSpriteBatch)1 Group (com.badlogic.gdx.scenes.scene2d.Group)1 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)1 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)1 Array (com.badlogic.gdx.utils.Array)1 FillViewport (com.badlogic.gdx.utils.viewport.FillViewport)1 FitViewport (com.badlogic.gdx.utils.viewport.FitViewport)1 ScalingViewport (com.badlogic.gdx.utils.viewport.ScalingViewport)1