dynamically creating a 2d array
hello, i am trying to write a simple tile map editor for my 2d game.
i want the user to input the number of tiles in the x and y directions for a map.
i have a map class and a tile class
i want my map class to contain a member that is a 2d array of objects of the tile class.
i am having trouble dynamically assigning the size of this array..
i thought the map class could contain a pointer to a tile object
and then later on in the code do something like:
Code:
cout<<"x: ";
cin>>x;
cout<<"y: ";
cin>>y;
m_tile = new cTile()[x][y]
however this gives an error,
what is the proper way to i achive this?