Dynamic Arrays

Started by
3 comments, last by TDragon 18 years, 7 months ago
Please can someone help me...I want to create a dynamic array which will be multi dimensional to hold 2D tiled map levels....Each Level can have several maps...each map being x,y in size.... [Level][MapNum][x][y] So to read the tile for Level 5, Map 2 at Position 10,10 you would do something like... MayMap[5][2][10][10].GetTile; Where should I start, using eith VC++ 2003.net or DevC++....please point me on the right direction....my head is exploding...aaawrrrggghh...
Advertisement
std::vector<std::vector<YourTileObject> > tiles;

I don't recommend going further than this 2-dimensional array to hold the tiles for a single map; you should load levels and maps in and out of memory dynamically to avoid overuse of memory (even a tiled map can still get pretty complex).

Cheers,
Twilight Dragon
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
How do I allocate multidimensional arrays using new? from the C++ FAQ lite.
Jooleem. Get addicted.
Or boost::multiarray.

Enigma
Quote:Original post by Enigma
Or boost::multiarray.

Enigma


Ah, oui. Forget what I said and go with Boost if at all possible.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++

This topic is closed to new replies.

Advertisement