use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class TiledMapDirectLoaderTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
map = new TmxMapLoader().load("data/maps/tiled/super-koalio/level1.tmx");
renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class TiledMapModifiedExternalTilesetTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.position.set(10.0f, 2.5f, 0.0f);
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
// These two maps should appear identical -- a ring of grass with water inside and out.
// The original is correct, without the bug fix to TiledMapTileSets.java that acompanies
// this test, the latter appears as all grass.
// map = new TmxMapLoader().load("data/maps/tiled/external-tilesets/test_original.tmx");
map = new TmxMapLoader().load("data/maps/tiled/external-tilesets/test_extended.tmx");
renderer = new IsometricTiledMapRenderer(map, 1f / 32f);
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class TiledMapObjectLoadingTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 100, 100);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
map = new TmxMapLoader().load("data/maps/tiled-objects/test-load-mapobjects.tmx");
MapProperties properties = map.getProperties();
shapeRenderer = new ShapeRenderer();
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class ViewportTest2 method create.
public void create() {
font = new BitmapFont();
font.setColor(0, 0, 0, 1);
Pixmap pixmap = new Pixmap(16, 16, Format.RGBA8888);
pixmap.setColor(1, 1, 1, 1);
pixmap.fill();
texture = new Texture(pixmap);
batch = new SpriteBatch();
camera = new OrthographicCamera();
camera.position.set(100, 100, 0);
camera.update();
viewports = ViewportTest1.getViewports(camera);
viewport = viewports.first();
names = ViewportTest1.getViewportNames();
name = names.first();
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean keyDown(int keycode) {
if (keycode == Input.Keys.SPACE) {
int index = (viewports.indexOf(viewport, true) + 1) % viewports.size;
name = names.get(index);
viewport = viewports.get(index);
resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
return false;
}
});
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class YDownTest method create.
@Override
public void create() {
// a bitmap font to draw some text, note that we
// pass true to the constructor, which flips glyphs on y
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), true);
// a texture region, note the flipping on y again
region = new TextureRegion(new Texture("data/badlogic.jpg"));
region.flip(false, true);
// a texture atlas, note the boolean
atlas = new TextureAtlas(Gdx.files.internal("data/pack"), true);
// a sprite, created from a region in the atlas
sprite = atlas.createSprite("badlogicsmall");
sprite.setPosition(0, 0);
// a sprite batch with which we want to render
batch = new SpriteBatch();
// a camera, note the setToOrtho call, which will set the y-axis
// to point downwards
camera = new OrthographicCamera();
camera.setToOrtho(true);
// a stage which uses our y-down camera and a simple actor (see MyActor below),
// which uses the flipped region. The key here is to
// set our y-down camera on the stage, the rest is just for demo purposes.
stage = new Stage();
stage.getViewport().setCamera(camera);
image = new MyActor(region);
image.setPosition(100, 100);
stage.addActor(image);
// finally we write up the stage as the input process and call it a day.
Gdx.input.setInputProcessor(stage);
}
Aggregations