Search in sources :

Example 21 with OrthographicCamera

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

the class BaseShadowSystem method addLight.

@Override
public void addLight(DirectionalLight dir) {
    OrthographicCamera camera = new OrthographicCamera();
    camera.direction.set(dir.direction);
    camera.near = 1;
    camera.far = 100;
    dirCameras.put(dir, new LightProperties(camera));
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera)

Example 22 with OrthographicCamera

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

the class SuperKoalio method create.

@Override
public void create() {
    // load the koala frames, split them, and assign them to Animations
    koalaTexture = new Texture("data/maps/tiled/super-koalio/koalio.png");
    TextureRegion[] regions = TextureRegion.split(koalaTexture, 18, 26)[0];
    stand = new Animation(0, regions[0]);
    jump = new Animation(0, regions[1]);
    walk = new Animation(0.15f, regions[2], regions[3], regions[4]);
    walk.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);
    // figure out the width and height of the koala for collision
    // detection and rendering by converting a koala frames pixel
    // size into world units (1 unit == 16 pixels)
    Koala.WIDTH = 1 / 16f * regions[0].getRegionWidth();
    Koala.HEIGHT = 1 / 16f * regions[0].getRegionHeight();
    // load the map, set the unit scale to 1/16 (1 unit == 16 pixels)
    map = new TmxMapLoader().load("data/maps/tiled/super-koalio/level1.tmx");
    renderer = new OrthogonalTiledMapRenderer(map, 1 / 16f);
    // create an orthographic camera, shows us 30x20 units of the world
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 30, 20);
    camera.update();
    // create the Koala we want to move around the world
    koala = new Koala();
    koala.position.set(20, 20);
    debugRenderer = new ShapeRenderer();
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) OrthogonalTiledMapRenderer(com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer) TmxMapLoader(com.badlogic.gdx.maps.tiled.TmxMapLoader) Animation(com.badlogic.gdx.graphics.g2d.Animation) OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) Texture(com.badlogic.gdx.graphics.Texture) ShapeRenderer(com.badlogic.gdx.graphics.glutils.ShapeRenderer)

Example 23 with OrthographicCamera

use of com.badlogic.gdx.graphics.OrthographicCamera in project myFirstGame by Juicebox47.

the class MyFirstGame method create.

@Override
public void create() {
    spriteBatch = new SpriteBatch();
    gameStateManager = new GameStateManager(new Stack<State>(), new OrthographicCamera(), new Vector3());
    Gdx.gl.glClearColor(0, 0, 0, 0);
    gameStateManager.push(new MenuState(gameStateManager));
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) Vector3(com.badlogic.gdx.math.Vector3) MenuState(com.mygdx.game.states.MenuState) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) GameStateManager(com.mygdx.game.states.GameStateManager) Stack(java.util.Stack)

Example 24 with OrthographicCamera

use of com.badlogic.gdx.graphics.OrthographicCamera in project bdx by GoranM.

the class Camera method initData.

public void initData(Type type) {
    this.type = type;
    if (type == Type.PERSPECTIVE) {
        data = new PerspectiveCamera();
    } else {
        data = new OrthographicCamera();
    }
    resolution = new Vector2f();
    ignoreObjects = new ArrayListNamed<GameObject>();
}
Also used : Vector2f(javax.vecmath.Vector2f) OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) PerspectiveCamera(com.badlogic.gdx.graphics.PerspectiveCamera)

Example 25 with OrthographicCamera

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

the class FreeTypePackTest method create.

@Override
public void create() {
    camera = new OrthographicCamera();
    batch = new SpriteBatch();
    long start = System.currentTimeMillis();
    int glyphCount = createFonts();
    long time = System.currentTimeMillis() - start;
    text = glyphCount + " glyphs packed in " + regions.size + " page(s) in " + time + " ms";
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch)

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