Original Post
I want to allocate a 2D array dynamically, but that won't fly...so, I am dynamically allocating a normal 1D array,
then, to get an emulated 2D array...I use this:
Does ^ THAT ^ do the trick...? It seems to...
_____________________________________________________
ICQ #: 149510932
Google - OpenGL - DirectX - Windows Guide Network - MSDN - Symantec Virus Info
"Imagination is more important than knowledge." - Albert Einstein
[edited by - Programmer One on April 12, 2002 10:03:16 PM]
// Translate Grid
int cGrid::translateGrid( int X, int Y )
{
// Pretend this is a 2D array
int arrBuf = X % xSize;
// xSize is emulated X side size of the '2D' grid.
// Return the actual position from the 2D position
return (arrBuf + Y);
}
To use this in my dynamically allocated array, i do:
theGrid[ translateGrid( xPos, yPos ) ];