use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class PixelPerfectTest method create.
@Override
public void create() {
Pixmap pixmap = new Pixmap(16, 16, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.BLUE);
pixmap.fill();
pixmap.setColor(Color.RED);
pixmap.drawLine(0, 0, 15, 15);
pixmap.drawLine(0, 15, 15, 0);
tex = new Texture(pixmap);
batch = new SpriteBatch();
cam = new OrthographicCamera();
cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class NinePatchTest method resize.
@Override
public void resize(int width, int height) {
float ratio = ((float) Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight());
int h = 10;
int w = (int) (h * ratio);
camera = new OrthographicCamera(w, h);
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class SimpleStageCullingTest method create.
@Override
public void create() {
// create a stage and a camera controller so we can pan the view.
stage = new Stage();
;
// we know it's an ortho cam at this point!
camController = new OrthoCamController((OrthographicCamera) stage.getCamera());
Gdx.input.setInputProcessor(camController);
// load a dummy texture
texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
// populate the stage with some actors and groups.
for (int i = 0; i < 5000; i++) {
Actor img = new CullableActor("img" + i, texture, (OrthographicCamera) stage.getCamera());
img.setX((float) Math.random() * 480 * 10);
img.setY((float) Math.random() * 320 * 10);
stage.addActor(img);
}
// we also want to output the number of visible actors, so we need a SpriteBatch and a BitmapFont
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class DecalTest method create.
@Override
public void create() {
Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
Gdx.gl.glDepthFunc(GL20.GL_LESS);
egg = new Texture(Gdx.files.internal("data/egg.png"));
egg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
egg.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
wheel = new Texture(Gdx.files.internal("data/wheel.png"));
wheel.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
wheel.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
w = Gdx.graphics.getWidth() / 0.8f;
h = Gdx.graphics.getHeight() / 0.8f;
for (int i = 0; i < INITIAL_RENDERED; i++) {
toRender.add(makeDecal());
}
cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.near = 0.1f;
cam.far = 10f;
cam.position.set(0, 0, 0.1f);
cam.direction.set(0, 0, -1f);
batch = new DecalBatch(new CameraGroupStrategy(cam));
Gdx.gl.glClearColor(1, 1, 0, 1);
}
use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.
the class ETC1Test method create.
@Override
public void create() {
font = new BitmapFont();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
controller = new OrthoCamController(camera);
Gdx.input.setInputProcessor(controller);
Pixmap pixmap = new Pixmap(32, 32, Format.RGB565);
pixmap.setColor(1, 0, 0, 1);
pixmap.fill();
pixmap.setColor(0, 1, 0, 1);
pixmap.drawLine(0, 0, 32, 32);
pixmap.drawLine(0, 32, 32, 0);
ETC1Data encodedImage = ETC1.encodeImagePKM(pixmap);
pixmap.dispose();
pixmap = ETC1.decodeImage(encodedImage, Format.RGB565);
encodedImage.dispose();
img1 = new Texture(pixmap);
img2 = new Texture("data/test.etc1");
batch = new SpriteBatch();
pixmap.dispose();
}
Aggregations