Code: Select all
int amount;
SDL_Rect tile;
tile = new Tile[ amount ];
Code: Select all
// HEADER
//make a global pointer to the tile
extern class Tile *p_tile;
class Tile{
public:
Tile( int width, int height, int type, int layer )
~Tile()
private:
int layer;
int height;
int width;
int type;
SDL_Rect tile;
};
//CPP FILE
//init global pointer to NULL
Tile *p_tile = 0;
Tile::Tile( int width, int height, int type, int layer ){
p_tile = this;
}
int main(){
int x, y, z, a;
Tile *p_tile = new Tile( x, y, z, a );
}
//and delete of course
well, if you guys can shed any light thanks, in the meantime I'll keep working at it