I have been putting a lot of effort into making a tile engine but I'm stuck on the map loading and saving. I want to save the map in a file so that I dont have 50*50 entries of a struct for each tile. The reason why I'm posting here is because I don't know a lot about binary file input/output. The way I have my engine load the tiles is by referencing the x and y position in a large bitmap file (of all tiles). Here is the structure I'm using.
I have read some articles on it but they don't go into too much detail. I'm hoping someone has ideas on whether I should use text files or binary files and how to go about designing them, or better yet, if someone has made a loader of their own that I could take a peek at. :)Code:typedef struct{
unsigned int ID; // Tile ID
unsigned int layer; // Tile layer
unsigned int xpos; // xpos of tile in bitmap
unsigned int ypos; // ypos of tile in bitmap
}TILE;