Create an grid array...

Posted by Anicho on Stack Overflow See other posts from Stack Overflow or by Anicho
Published on 2010-04-25T19:23:36Z Indexed on 2010/04/25 19:33 UTC
Read the original article Hit count: 317

Okay so I am looking to create a grided array in OGRE3D game engine but the array is generic my array skills are pretty basic and need work so I am posting this just to be sure I am doing this correctly.

#define GRIDWIDTH 10
#define GRIDHEIGHT 10

int myGrid [HEIGHT][WIDTH];
int n,m;

int main ()
{
  for (n=0;n<HEIGHT;n++)
    for (m=0;m<WIDTH;m++)
    {
      jimmy[n][m]=(n+1)*(m+1);
    }
  return 0;
}

I am assuming the above will return:

 1 2 3 4 5 6 7 8 9 10
1
2
3
4
5
6
7
8
9
10

Then I can assign each point in the array to a valid node in OGRE3D to create a grid in 3D view would this work? Just need to tell me if I am doing it right or wrong dont need the ogre3d code....

© Stack Overflow or respective owner

Related posts about arrays

Related posts about multidimensional-array