Tile Pointers
It''s 3:00am... just thought I''d let you all know.
Okay, right now I just completely confused myself about structures, pointers, memory addresses, the "new" keyword, and the -> operator... it''s 3:00am. I thought I had this stuff down cold
I have, say, a board that is 2x2 tiles long, and each tile contains a pointer to the type of tile it is: either filled, or not filled.
What would be the easiest, most efficient way of declaring all this? (code, please! hehe)
(The reason I am wondering all this, by the way, is that I think that this would be the most efficient way to do tiles in a game where a bitmap for the same tile would be shown over and over again. Instead of reloading the bitmap eachtime or something horrible like that, you just have the tile point to the type of tile it is that contains the bitmap... uhhh, right?)
Thanks!
- Goblin
"A woodchuck would chuck as much wood as a woodchuck could if a woodchuck could chuck wood. Deal."
- The Goblin (madgob@aol.com)
Hi,
One way to go is:
use a list of ptrs to images and then a list of tiles. These tiles are INDEXES into imagelist. It''s simple.
something like this:
did it answer your question? If not, sorry.
/Mankind gave birth to God.
One way to go is:
use a list of ptrs to images and then a list of tiles. These tiles are INDEXES into imagelist. It''s simple.
something like this:
CImage* list[NUMIMAGES];int tiles[2*2];tile[0] = 2;tile[1] = 0;tile[2] = 1;tile[3] = 34;
did it answer your question? If not, sorry.
/Mankind gave birth to God.
/Mankind gave birth to God.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement