use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class FilterPerformanceTest method create.
public void create() {
batch = new SpriteBatch();
sceneMatrix = new Matrix4().setToOrtho2D(0, 0, 480, 320);
textMatrix = new Matrix4().setToOrtho2D(0, 0, 480, 320);
atlas = new TextureAtlas(Gdx.files.internal("data/issue_pack"), Gdx.files.internal("data/"));
texture = new Texture(Gdx.files.internal("data/resource1.jpg"), true);
texture.setFilter(TextureFilter.MipMap, TextureFilter.Nearest);
setTextureFilter(0);
setModeString();
sprite = atlas.createSprite("map");
sprite2 = new Sprite(texture, 0, 0, 855, 480);
font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean touchDown(int x, int y, int pointer, int newParam) {
mode++;
if (mode == filters.length * 2)
mode = 0;
setTextureFilter(mode / 2);
setModeString();
return false;
}
});
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class Box2DCharacterControllerTest method create.
@Override
public void create() {
world = new World(new Vector2(0, -40), true);
renderer = new Box2DDebugRenderer();
cam = new OrthographicCamera(28, 20);
createWorld();
Gdx.input.setInputProcessor(this);
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class Box2DTest method create.
@Override
public void create() {
// setup the camera. In Box2D we operate on a
// meter scale, pixels won't do it. So we use
// an orthographic camera with a viewport of
// 48 meters in width and 32 meters in height.
// We also position the camera so that it
// looks at (0,16) (that's where the middle of the
// screen will be located).
camera = new OrthographicCamera(48, 32);
camera.position.set(0, 16, 0);
// next we setup the immediate mode renderer
renderer = new ShapeRenderer();
// next we create the box2d debug renderer
debugRenderer = new Box2DDebugRenderer();
// next we create a SpriteBatch and a font
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
font.setColor(Color.RED);
textureRegion = new TextureRegion(new Texture(Gdx.files.internal("data/badlogicsmall.jpg")));
// next we create out physics world.
createPhysicsWorld();
// register ourselfs as an InputProcessor
Gdx.input.setInputProcessor(this);
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class BulletTestCollection method create.
@Override
public void create() {
if (app == null) {
app = Gdx.app;
tests[testIndex].create();
}
cameraController = new CameraInputController(tests[testIndex].camera);
cameraController.activateKey = Keys.CONTROL_LEFT;
cameraController.autoUpdate = false;
cameraController.forwardTarget = false;
cameraController.translateTarget = false;
Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
hud = new Stage();
hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
fpsLabel.setPosition(0, 0);
hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
instructLabel.setAlignment(Align.top | Align.left);
instructLabel.setText(tests[testIndex].instructions);
}
use of com.badlogic.gdx.graphics.g2d.BitmapFont in project libgdx by libgdx.
the class BitmapFontAlignmentTest method create.
@Override
public void create() {
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean touchDown(int x, int y, int pointer, int newParam) {
renderMode = (renderMode + 1) % 6;
return false;
}
});
spriteBatch = new SpriteBatch();
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
logoSprite = new Sprite(texture);
logoSprite.setColor(1, 1, 1, 0.6f);
logoSprite.setBounds(50, 100, 400, 100);
font = new BitmapFont(Gdx.files.getFileHandle("data/verdana39.fnt", FileType.Internal), Gdx.files.getFileHandle("data/verdana39.png", FileType.Internal), false);
cache = font.newFontCache();
layout = new GlyphLayout();
}
Aggregations