//Prototype Options File windowedmode 1 width 800 height 600 backgroundred 100 backgroundgreen 255 backgroundblue 100 |
//open the file
FILE * pFile = fopen("system//startup.txt", "r");
//check to see if it opened
if(pFile == NULL)
{
logfile.LogtoFile("D3D - failed to open startup file\n");
return E_FAIL;
}
//check to make sure its the right file
if(fscanf(pFile, "//Prototype Options File ") == EOF)
{
logfile.LogtoFile("D3D - failed to verify startup file type\n");
return E_FAIL;
}
//try reading in the windowed mode variable from the file
if(fscanf(pFile, "windowedmode %d", &Windowed) == EOF)
{
logfile.LogtoFile("D3D - failed to load windowed mode variable\n");
return E_FAIL;
}
//try reading in the resolution
//width...
if(fscanf(pFile, " width %d ", &ScreenWidth) == 0)
{
logfile.LogtoFile("D3D - failed to load screen width from file\n");
return E_FAIL;
}
//height...
if(fscanf(pFile, " height %d", &ScreenHeight) == 0)
{
logfile.LogtoFile("D3D - failed to load screen height from file\n");
return E_FAIL;
}
|
