Well, now I’m confused. I redid my code to look like this:
package com.nishu.particaletest;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.nishu.particaletest.entities.Tile;
public class GameScreen implements Screen {
OrthographicCamera camera;
SpriteBatch batch;
Sprite sprite;
Tile[][] tiles;
int sWidth = ParticaleGame.getWIDTH();
int sHeight = ParticaleGame.getHEIGHT();
int width = sWidth / Tile.SIZE;
int height = sHeight / Tile.SIZE;
@Override
public void show() {
camera = new OrthographicCamera();
camera.setToOrtho(false, ParticaleGame.getWIDTH(),
ParticaleGame.getHEIGHT());
batch = new SpriteBatch();
tiles = new Tile[width][height + Tile.SIZE];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height + Tile.SIZE; y++) {
tiles[x][y] = new Tile(x, y, false, false);
System.out.println(tiles[x][y].getTile().getX() + " , " + tiles[x][y].getTile().getY());
}
}
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0.2f, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
camera.update();
batch.setProjectionMatrix(camera.combined);
batch.begin();
for (int x = 0; x < width; x++) {
for (int y = 0; y < height + Tile.SIZE; y++) {
//tiles[x][y].setPos(x, y);
tiles[x][y].getTile().draw(batch);
System.out.println("Render: " + tiles[x][y].getTile().getX() + " , " + tiles[x][y].getTile().getY());
}
}
batch.end();
}
@Override
public void dispose() {
batch.dispose();
}
@Override
public void resize(int width, int height) {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
}
The output for the rendering coords are this(it works, I’m only showing a section of it):
Render: 752.0 , 288.0
Render: 752.0 , 304.0
Render: 752.0 , 320.0
Render: 752.0 , 336.0
Render: 752.0 , 352.0
Render: 752.0 , 368.0
Render: 752.0 , 384.0
Yet, I still end up with a blank screen. Why?