Sorry if I'm not explaining good for it's 12:34 am and i'm doing late night programming but I need help. Btw this is in LWJGL Here's my Code:
I keep getting a null pointer error for the addAt() and the draw(); Basicly there is a couple classes that make it so when I click it will run addAt(mousex,mousey); and in the render loop it will keep drawing. The class that is new Block(x,y) is a class that will draw the QUAD.
//beggining
public class Grid {
Block[][] blocks = new Block[25][25];
public Grid(){
for (int x = 0; x < 25 - 1; x++) {
for (int y = 0; y < 16 - 1; y++) {
blocks[x][y] = new Block(x,y);
}
}
}
public void draw(){
for (int x = 0; x < 25;x++){
for (int y = 0; y < 25;y++){
blocks[x][y].draw();
}
}
}
public void addAt(int x,int y){
blocks[x][y] = new Block(x,y);
}
}
//end
basicly the Main is just making a Display and running the draw loop and the input listener.
Then the Block class is just making a quad at the defined x and y.
Sorry if I disobeyed a stack overflow rule. This is my First post and it's at a late time.:) Thanks in advance!
addAtcall? It shouldn't make any problems unlessblocksis null, and it can't be. The problem probably occurs ondraw.