http://badlogicgames.com/forum/viewtopic.php?f=11&t=2447 http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/OrthographicCamera.htmlRéglage de la applcation utiliser « y-down » dans LibGDX
Il y a des centaines d'autres liens que je pourrais vous montrer que je l'ai regardé, mais il est tout simplement pas la peine parce qu'ils disent tous la même chose.
public class InGame implements Screen {
SpriteBatch batch;
GameWorld world;
OrthographicCamera camera;
@Override
public void show() {
batch = new SpriteBatch();
world = new GameWorld();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
batch.setProjectionMatrix(camera.combined);
batch.begin();
world.render(batch, delta);
batch.end();
}
}
Qu'est-ce que je fais mal? POURQUOI mon monde est-il encore rendu avec le 0,0 étant en bas à droite. Les maths derrière cela en essayant de travailler sur mon Tile-System me rendent absolument fou.
World-> Rendu
public void render(SpriteBatch batch, float delta) {
for(int xAxis = 0; xAxis < worldColumns; xAxis++) {
for(int yAxis = 0; yAxis < worldRows; yAxis++) {
tiles[xAxis][yAxis].render(batch, delta);
}
}
}
WorldTile-> Rendu
public void render(SpriteBatch batch, float delta) {
myShape.begin(ShapeType.Filled);
myShape.setColor(tileColor);
myShape.rect(pos.getX(), pos.getY(), TILE_WIDTH, TILE_HEIGHT);
myShape.end();
}
Le "pos" est la position (x, y) qui a été adoptée dans la classe mondiale.