Search in sources :

Example 31 with OrthographicCamera

use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.

the class GestureDetectorTest method create.

@Override
public void create() {
    texture = new Texture("data/stones.jpg");
    batch = new SpriteBatch();
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    controller = new CameraController();
    gestureDetector = new GestureDetector(20, 0.5f, 2, 0.15f, controller);
    Gdx.input.setInputProcessor(gestureDetector);
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) GestureDetector(com.badlogic.gdx.input.GestureDetector) Texture(com.badlogic.gdx.graphics.Texture) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch)

Example 32 with OrthographicCamera

use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.

the class MultitouchTest method create.

@Override
public void create() {
    Gdx.app.log("Multitouch", "multitouch supported: " + Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen));
    renderer = new ShapeRenderer();
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.position.set(Gdx.graphics.getWidth() / 2.0f, Gdx.graphics.getHeight() / 2.0f, 0);
    Gdx.input.setInputProcessor(this);
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) ShapeRenderer(com.badlogic.gdx.graphics.glutils.ShapeRenderer)

Example 33 with OrthographicCamera

use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.

the class InverseKinematicsTest method create.

@Override
public void create() {
    float aspect = Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight();
    camera = new OrthographicCamera(15 * aspect, 15);
    camera.update();
    renderer = new ShapeRenderer();
    renderer.setProjectionMatrix(camera.combined);
    bones = new Bone[] { new Bone("bone0", 0, 0, 0), new Bone("bone1", 0, 2, 2), new Bone("bone2", 0, 4, 2), new Bone("bone3", 0, 6, 2), new Bone("end", 0, 8, 2) };
    globalCoords.set(bones[0].position);
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) ShapeRenderer(com.badlogic.gdx.graphics.glutils.ShapeRenderer)

Example 34 with OrthographicCamera

use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.

the class CullTest method create.

@Override
public void create() {
    ModelBuilder builder = new ModelBuilder();
    sphere = builder.createSphere(2f, 2f, 2f, 16, 16, new Material(new ColorAttribute(ColorAttribute.Diffuse, Color.WHITE)), Usage.Position | Usage.Normal);
    // cam = new PerspectiveCamera(45, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam = new OrthographicCamera(45, 45 * (Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight()));
    cam.near = 1;
    cam.far = 200;
    Random rand = new Random();
    for (int i = 0; i < instances.length; i++) {
        pos.set(rand.nextFloat() * 100 - rand.nextFloat() * 100, rand.nextFloat() * 100 - rand.nextFloat() * 100, rand.nextFloat() * -100 - 3);
        instances[i] = new ModelInstance(sphere, pos);
    }
    modelBatch = new ModelBatch();
    batch = new SpriteBatch();
    font = new BitmapFont();
// Gdx.graphics.setVSync(true);
// Gdx.app.log("CullTest", "" + Gdx.graphics.getBufferFormat().toString());
}
Also used : ModelInstance(com.badlogic.gdx.graphics.g3d.ModelInstance) ModelBuilder(com.badlogic.gdx.graphics.g3d.utils.ModelBuilder) Random(java.util.Random) ModelBatch(com.badlogic.gdx.graphics.g3d.ModelBatch) OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) Material(com.badlogic.gdx.graphics.g3d.Material) ColorAttribute(com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch)

Example 35 with OrthographicCamera

use of com.badlogic.gdx.graphics.OrthographicCamera in project libgdx by libgdx.

the class DecalTest method resize.

@Override
public void resize(int width, int height) {
    w = Gdx.graphics.getWidth() / 0.8f;
    h = Gdx.graphics.getHeight() / 0.8f;
    cam = new OrthographicCamera(width, height);
    cam.near = 0.1f;
    cam.far = 10f;
    cam.position.set(0, 0, 0.1f);
    cam.direction.set(0, 0, -1f);
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera)

Aggregations

OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)50 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)32 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)21 Texture (com.badlogic.gdx.graphics.Texture)20 OrthoCamController (com.badlogic.gdx.tests.utils.OrthoCamController)15 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)10 ShapeRenderer (com.badlogic.gdx.graphics.glutils.ShapeRenderer)10 OrthogonalTiledMapRenderer (com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer)7 TmxMapLoader (com.badlogic.gdx.maps.tiled.TmxMapLoader)6 Box2DDebugRenderer (com.badlogic.gdx.physics.box2d.Box2DDebugRenderer)6 AssetManager (com.badlogic.gdx.assets.AssetManager)5 InternalFileHandleResolver (com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver)4 Pixmap (com.badlogic.gdx.graphics.Pixmap)4 PerspectiveCamera (com.badlogic.gdx.graphics.PerspectiveCamera)3 PolygonSpriteBatch (com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch)3 Vector2 (com.badlogic.gdx.math.Vector2)3 World (com.badlogic.gdx.physics.box2d.World)3 Stage (com.badlogic.gdx.scenes.scene2d.Stage)3 InputAdapter (com.badlogic.gdx.InputAdapter)2 InputMultiplexer (com.badlogic.gdx.InputMultiplexer)2