0
스프라이트 중심에서 글꼴 그리기에 문제가 있습니다. 스프라이트가 화면을 따라 움직입니다.움직이는 스프라이트 안의 드로잉 글꼴 libgdx
batch.setProjectionMatrix(camera.combined);
batch.begin();
spr.draw(batch);
font.setScale(1, (w/h)*3);
font.draw(batchFont, mDate, valueX, valueY);
batch.end();
나는 스프라이트의 중심에있는 글꼴을 그릴해야합니다
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));
내부 내가 코드를 렌더링 :
w = Gdx.graphics.getWidth();
h = Gdx.graphics.getHeight();
camera = new OrthographicCamera(1, h/w);
과 : 나는 내 직교 카메라를 설정합니다. 누구든지 valueX 및 ValueY를 계산하는 방법을 알려주시겠습니까? P보다 일반적인 접근 방식 : 그것은 쓸모에 대한
나 자신에 의해 답을 발견 : X = (spr.getX() + 0.5f) * (screen.width()) – Lunatikul