1

私は間違ったフォークを何をしていますか?

public class Memoration implements ApplicationListener {
private OrthographicCamera camera;
public SpriteBatch batch;
public static float w, h;
public BitmapFont clickBitmapFont;

@Override
public void create() {
    camera = new OrthographicCamera(1, h / w);
    batch = new SpriteBatch();
    w = Gdx.graphics.getWidth();
    h = Gdx.graphics.getHeight();
    Matrix4 normalProjection = new Matrix4().setToOrtho2D(0, 0, w, h); // acording to http://stackoverflow.com/questions/12895822/how-to-draw-a-bitmapfont-in-libgdx it should work...
    batch.setProjectionMatrix(normalProjection);

    clickBitmapFont = new BitmapFont(Gdx.files.internal("data/font.fnt"),Gdx.files.internal("data/font.png"),false);
    clickBitmapFont.setColor(Color.BLUE);
}

@Override
public void dispose() {
    batch.dispose();
}

@Override
public void render() {
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    batch.setProjectionMatrix(camera.combined);

    batch.begin();
    draw();
    batch.end();
}

    public void draw(){
    clickBitmapFont.draw(batch, "hello StackOverflow", 100, 100);
}
}

.fnt と .png に BMFont を使用したため、おそらく問題はありません..

4

0 に答える 0