use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class AccelerometerTest method create.
@Override
public void create() {
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
batch = new SpriteBatch();
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class VibratorTest method create.
@Override
public void create() {
batch = new SpriteBatch();
font = new BitmapFont();
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class TiledMapBench method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 320, 320);
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
{
tiles = new Texture(Gdx.files.internal("data/maps/tiled/tiles.png"));
TextureRegion[][] splitTiles = TextureRegion.split(tiles, 32, 32);
map = new TiledMap();
MapLayers layers = map.getLayers();
for (int l = 0; l < 20; l++) {
TiledMapTileLayer layer = new TiledMapTileLayer(150, 100, 32, 32);
for (int x = 0; x < 150; x++) {
for (int y = 0; y < 100; y++) {
int ty = (int) (Math.random() * splitTiles.length);
int tx = (int) (Math.random() * splitTiles[ty].length);
Cell cell = new Cell();
cell.setTile(new StaticTiledMapTile(splitTiles[ty][tx]));
layer.setCell(x, y, cell);
}
}
layers.add(layer);
}
}
renderer = new OrthogonalTiledMapRenderer(map);
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class TiledMapLayerOffsetTest 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.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
shapeRenderer = new ShapeRenderer();
assetManager = new AssetManager();
assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
assetManager.load(MAP_ORTHO, TiledMap.class);
assetManager.load(MAP_ISO, TiledMap.class);
assetManager.load(MAP_ISO_STAG, TiledMap.class);
assetManager.load(MAP_HEX_X, TiledMap.class);
assetManager.load(MAP_HEX_Y, TiledMap.class);
assetManager.finishLoading();
map = assetManager.get(MAP_ORTHO);
renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class TextureAtlasTest method create.
public void create() {
batch = new SpriteBatch();
renderer = new ShapeRenderer();
atlas = new TextureAtlas(Gdx.files.internal("data/pack"));
jumpAtlas = new TextureAtlas(Gdx.files.internal("data/jump.txt"));
jumpAnimation = new Animation(0.25f, jumpAtlas.findRegions("ALIEN_JUMP_"));
badlogic = atlas.createSprite("badlogicslice");
badlogic.setPosition(50, 50);
// badlogicSmall = atlas.createSprite("badlogicsmall");
badlogicSmall = atlas.createSprite("badlogicsmall-rotated");
badlogicSmall.setPosition(10, 10);
AtlasRegion region = atlas.findRegion("badlogicsmall");
System.out.println("badlogicSmall original size: " + region.originalWidth + ", " + region.originalHeight);
System.out.println("badlogicSmall packed size: " + region.packedWidth + ", " + region.packedHeight);
star = atlas.createSprite("particle-star");
star.setPosition(10, 70);
font = new BitmapFont(Gdx.files.internal("data/font.fnt"), atlas.findRegion("font"), false);
Gdx.gl.glClearColor(0, 1, 0, 1);
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean keyUp(int keycode) {
if (keycode == Keys.UP) {
badlogicSmall.flip(false, true);
} else if (keycode == Keys.RIGHT) {
badlogicSmall.flip(true, false);
} else if (keycode == Keys.LEFT) {
badlogicSmall.setSize(512, 512);
} else if (keycode == Keys.DOWN) {
badlogicSmall.rotate90(true);
}
return super.keyUp(keycode);
}
});
}
Aggregations