void Tileset::write( FILE *file)
{
for (int i = 0; i < mTiles.size(); ++i)
{
unsigned int size = 0;
mTiles[i]->image().save( &buffer, "PNG", -1);
buffer.close();
size = (unsigned int)ba.size();
char *data = new char[size];
data = ba.data();
fwrite( &size, sizeof(unsigned int), 1, file);
fwrite( data, sizeof(char), size, file);
}
}
void Tileset::write( FILE *file)
{
for (int i = 0; i < mTiles.size(); ++i)
{
QByteArray ba;
QBuffer buffer( &ba);
unsigned int size = 0;
buffer.open( QIODevice::WriteOnly);
mTiles[i]->image().save( &buffer, "PNG", -1);
buffer.close();
size = (unsigned int)ba.size();
char *data = new char[size];
data = ba.data();
fwrite( &size, sizeof(unsigned int), 1, file);
fwrite( data, sizeof(char), size, file);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks