libgdx를 사용하여 디버깅 할 줄을 그려보고 싶지만 실패했습니다. 이것은 내가libgdx를 사용하여 선을 그리는 방법은 무엇입니까?
shapeDebugger.setProjectionMatrix이 (camera.combined) 라인에서 오류가 내 코드
public class MainMenu extends Screen implements InputProcessor {
private OrthographicCamera camera;
SpriteBatch myBatch;
ShapeRenderer shapeDebugger;
public MainMenu(Game game) {
super(game);
camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.update();}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
myBatch.begin();
stage.draw();
Gdx.gl10.glLineWidth(10);
shapeDebugger.setProjectionMatrix(camera.combined);
shapeDebugger.begin(ShapeType.Line);
shapeDebugger.setColor(1, 1, 1, 1);
shapeDebugger.line(2, 2, 5, 5);
myBatch.end();
}
}
이다; Pranav008
@
은 대단히 감사합니다. 나는 그것을 시작할 필요가 있다고 기대하지 않았다. 하지만 나는 진정한 문제가있어. 나는 이처럼 게임 스크린의 중앙에 선을 그린다.
Gdx.gl10.glLineWidth(2);
shapeDebugger.setProjectionMatrix(camera.combined);
shapeDebugger.begin(ShapeType.Line);
shapeDebugger.setColor(1, 1, 1, 1);
shapeDebugger.line(Gdx.graphics.getWidth()/2, 0,Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight());
shapeDebugger.end();
화면 크기를 조정하려고하면 화면이 중앙으로 업데이트되지 않고 오른쪽으로 멀리 이동합니다.
어떤 오류가 발생 했습니까? 실행 시간인가, 컴파일 타임인가? –