Game Development Reference
In-Depth Information
gives the version number, so that the code can react to the remaining
data. Following version number is a byte-sized flag that currently is only
used to indicate whether to use scene 1 as a loading scene. If this is the
case, then the control will display the frames in scene 1 proportional to the
load of the next scene. If the scene has 100 frames and the next scene is
50 per cent loaded then the control will display frame 50 of this scene. The
next bytes are an array of 4-byte integers storing the length of each
scene. The ActiveX control can check the size of the data file that is
loaded against this array. If the code requires a load of scene 4 and
current loading is perhaps only half way through scene 2, then Toon3D
calculates the bytes needed to load scene 4. If a load scene is used, then
this will display its current frame based on the length of the load scene
and the number of bytes remaining to be loaded against the total bytes to
load when the load scene was initialized.
Since Toon3D is an ActiveX control intended for use on a web page
development environment, Toon3D Creator allows the user to easily
create an html page that will embed the control and the data file that is
being created. The next section of the function that creates a compressed
file creates this html file using the MFC implementation of a text file. MFC
has several file types; a standard text file is created and written to using
CStdioFile.
void CToon3DDoc::OnFilePublish()
{
CMainFrame *pFrm = (CMainFrame*)AfxGetApp()->m_pMainWnd;
CStatusBar *pStatus = &pFrm->m_wndStatusBar;
CString str = GetPathName(), msg;
str = str.Left(str.GetLength()-3) + “t3x”;
CString filename = str;
CFile file(str, CFile::modeCreate|CFile::modeWrite);
CArchive ar(&file, CArchive::store);
CToon3DScene *scn = sceneList.next;
char buf[]={'T', '3', 'D', 'X'};
ar.Write(buf, 4);
int i, pos;
USHORT sht;
BYTE byt, byt2;
//Count how many scenes there are in the project
while(scn){ i++, scn = scn->next;}
//Store number of scenes as one byte integer if total less than 128
Search Nedrilad ::




Custom Search