In my isometrical game I have a lot of tiles which I store in separate files, each time I load a level, I load only tiles needed for this level.
To restrict access to my files for user I decided to use some *.dat files for different tile sets. To start I just tried to write a code for loading images using LoadImage(const uint8_t* pBegin, const uint8_t* pEnd );
I started from a simple loading a gif file to buffer and then creating Surface from buffer contents, but the code I use loads an uncomplite image, whats wrong?
What is wrong?
To restrict access to my files for user I decided to use some *.dat files for different tile sets. To start I just tried to write a code for loading images using LoadImage(const uint8_t* pBegin, const uint8_t* pEnd );
I started from a simple loading a gif file to buffer and then creating Surface from buffer contents, but the code I use loads an uncomplite image, whats wrong?
- Code:
typedef unsigned __int8/*unsigned char*/ ui8;
bool LibGen::GameInit()
{
int count, total = 0;
ui8 buffer[32000];
FILE *stream;
TCHAR FullFileName[MAX_PATH];
TCHAR FullPath[MAX_PATH];
wcscpy(FullFileName, _T("in.gif") );
if (PocketPC::GetFullPathName(FullFileName, FullPath)==0){return false;}
if( (stream = _wfopen( FullPath, _T("r") )) == NULL ){return false;}
//Just trying to read byte by byte
while( !feof( stream ) )
{
count = fread( &buffer;[total], sizeof( ui8 ), 1, stream );
total += count;
}
fclose( stream );
inSurf = LoadImage(pDisplay, &buffer;[0], &buffer;[total-1] );
return true;
}
What is wrong?