我在精灵中心绘制字体时遇到了一些问题。精灵沿着屏幕移动。我将正交相机设置为:
w = Gdx.graphics.getWidth();
h = Gdx.graphics.getHeight();
camera = new OrthographicCamera(1, h/w);
和:
Sprite spr = new Sprite(starTx);
spr.setSize(0.3f, 0.3f);
spr.setOrigin(0.15f, 0.15f);
spr.setPosition(0.2f, 0.25f*(i+1));
在渲染内部我有代码:
batch.setProjectionMatrix(camera.combined);
batch.begin();
spr.draw(batch);
font.setScale(1, (w/h)*3);
font.draw(batchFont, mDate, valueX, valueY);
batch.end();
我必须在精灵的中心绘制字体。谁能告诉我如何计算 valueX 和 ValueY?