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);
}
}
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;
}
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));
}
}
}
}
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);
}
Aggregations