Hm it was in my Labyrinth plugin instead which never got released Write a .lvl file char buf[4];//the char array
Uint32 *data=(Uint32*)buf;//pointer to the array
int tile=0;//info we want in file
int x=0;
int y=0;
ofstream file("get/labyrinth.lvl", ios::binary | ios::app);//open a file in binary mode
file.seekp(0, ios::end); //Make sure we append at the end of the file
*data = ((tile & 0xFF) << 24) | ((i & 0x3FF) << 12) | (x & 0x3FF);
//^^^^--pushes data into the array, If you know the data is good then you dont need the bitwise &
file.write(buf, 4);//write
file.close(); If you want a tileset, you need to prepend a bitmap image or level file (which is almost the same): ifstream org("labyrinth.lvl", ios::binary);
ofstream nnew("get/labyrinth.lvl", ios::binary | ios::trunc);
nnew << org.rdbuf();
org.close();
nnew.close(); Note; you need to do this before writing any other tiles (before the first piece of code) since the bitmap has to be at the begin of the file. Reading a map.lvl file: I seem to have lost that piece of code. It's pretty easy, you only need to read that buf[4] array out each time until you reach the end of the file. However, make sure you skip the first 3435921408 bytes if the file begins with "BM-" (it's the size of the BMP image).