libgdx로 작업 중이므로 카메라의 위치를 설정하지 않으면 게임이 완벽하게 렌더링됩니다. 하지만이 한 줄의 코드를 추가하면 : camera.position.set (0f, 0f, 0f), 모든 스프라이트에 흰색 선이 표시됩니다.libgdx camera.position.set으로 인해 찢어짐이 발생합니다.
전 :
한 줄의 코드 추가 한 후 : camera.postion.set (0F, 0F을 0F)
레이아웃이 다르기 때문에 이러한 이미지는 랜덤 맵입니다. 변경된 유일한 것은 흰색 선입니다. 카메라가 위치 (0, 0, 0)로 이동합니다. 이 문제의 원인은 무엇일까요? 그것은 기본적으로 내 스프라이트 상단에 1 개의 흰색 픽셀을 추가합니다. 64x64 타일이있는 512x512 타일 시트가 있습니다.
@Override
public void show()
{
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
this.camera = new OrthographicCamera(w, h);
this.camera.setToOrtho(true, w, h);
this.stage.setCamera(this.camera);
camera.update();
this.input = new InputHandler(this.camera);
Gdx.input.setInputProcessor(this.input);
dungeon = new Dungeon(DungeonGenerator.generateDungeonMap());
renderer = new OrthogonalTiledMapRenderer(dungeon);
this.player = new Player(dungeon);
this.stage.addActor(this.player);
camera.position.set(0f, 0f, 0f);
}
@Override
public void render(float delta)
{
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
renderer.setView(camera);
renderer.render();
batch.begin();
font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
font.draw(batch, "camera: " + camera.position, 10, 50);
font.draw(batch, "Stage:" + this.stage.getCamera().position, 10, 80);
batch.end();
//update and render stage actors
stage.act(delta);
stage.draw();
}
이 내용이 적용될 수 있습니다. http://stackoverflow.com/questions/15883120/orthogonaltiledmaprenderer-and-normal-spritebatch-renders-a-white-box – arynaq
Thanks. 방금 읽었 어. 나는 지금 당장 그 해결책을 시도하고있다. 그러나 나는 그것이 같은 문제라고 생각하지 않는다. – theDazzler
나는 batch.begin()과 batch.end()를 사용하여 다른 것들을 시도했지만 링크의 솔루션처럼 작동하지 않았다. – theDazzler