Q
!Q
Maximus said:Hi,
Ok my problem is hard to explain... I'm making a directdraw based program
and of course maps. I can put texture on my map but I want to save those
information in a structure with a x, y and a texture variable assigned to
that coord in order to recreate the map over and over again. Think about it,
how would you make that structure or anything else that would do the job...?
First I came with a very stupid conclusion:
struct DDMAP
{
int x[64];
int y[64];
int texture[255];//Assume I have 255 texture in a file
};
But when I came up to save it I saw that it was impossible. Try to save
that:
x1,y1 = texture #10
x1,y2 = texture #120
See what I mean!
Thanks for any help,
Max.
const int MAP_WIDTH = 64;
const int MAP_HEIGHT = 64;
const int NUM_TEXTURES = 256;
unsigned char map[MAP_HEIGHT][MAP_WIDTH];
Texture textures[NUM_TEXTURES];
map[j] = texture index
so to draw it you would do something like:
drawTexture(x, y, textures[map[j]]);
pretty static, pretty simple
!Q