loading tile levels from resources
how do you load the tile levels from resources?
I don''t want array, or something like it in my code, I want to change my levels without recompiling, so how do I do this?
A text file?
DX++ The DirectX Programming Site
Hi,
The best thing to start off with is to create a structure with all the properties that you will need for a tile. Then you can simply create a file in binary mode (or text if you wish) and write the contents of the structure (for as many tiles as there will be in your world) to file. Like this you can use another program to modify the level without needing to recompile your code.
Hope this helps.
--Antz
Quanta Entertainment
http://www.quanta-entertainment.com
The best thing to start off with is to create a structure with all the properties that you will need for a tile. Then you can simply create a file in binary mode (or text if you wish) and write the contents of the structure (for as many tiles as there will be in your world) to file. Like this you can use another program to modify the level without needing to recompile your code.
Hope this helps.
--Antz
Quanta Entertainment
http://www.quanta-entertainment.com
Thanks for the help,
but can anyone give me a short code example?
I''m still clueless.
DX++ The DirectX Programming Site
but can anyone give me a short code example?
I''m still clueless.
DX++ The DirectX Programming Site
I have a very fast code for retrieving the map information from a file in binary mode but it is in VB.If you are fond with VB tell me to post it.
Voodoo4
Voodoo4
Here these words vilifiers and pretenders, please let me die in solitude...
typedef struct
{
bool blocked;
int type;
...
} tile;
typedef struct
{
int width;
int height;
...
} map_header;
...
fread(&header, ...);
fread(tile_array, sizeof(tile), width * height, ...);
"Paranoia is the belief in a hidden order behind the visible." - Anonymous
Edited by - Staffan on August 13, 2000 2:22:25 PM
{
bool blocked;
int type;
...
} tile;
typedef struct
{
int width;
int height;
...
} map_header;
...
fread(&header, ...);
fread(tile_array, sizeof(tile), width * height, ...);
"Paranoia is the belief in a hidden order behind the visible." - Anonymous
Edited by - Staffan on August 13, 2000 2:22:25 PM
If you want to load data from your custom resources, you can check out this homepage tutorial including full source code: Using Custom Resources
It''s about loading your texture into an OpenGL texture, but you can easily convert it to your need...
It''s about loading your texture into an OpenGL texture, but you can easily convert it to your need...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement