本文整理汇总了C++中CTFileStream::Create_t方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFileStream::Create_t方法的具体用法?C++ CTFileStream::Create_t怎么用?C++ CTFileStream::Create_t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFileStream
的用法示例。
在下文中一共展示了CTFileStream::Create_t方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveAnimSetFile
// save anim set file
BOOL CSeriousSkaStudioApp::SaveAnimSetFile(CAnimSet &as, BOOL bConvert)
{
DisableRendering();
CTFileName fnAnimSet = as.GetName();
fnAnimSet = fnAnimSet.NoExt() + ".aal";
try {
fnAnimSet.RemoveApplicationPath_t();
} catch(char *){}
// back up current skeleton list file
CTString strBackUp;
try {
strBackUp.Load_t(fnAnimSet);
} catch(char*){}
CTFileStream ostrFile;
try {
ostrFile.Create_t(fnAnimSet,CTStream::CM_TEXT);
SaveAnimSet_t(as,ostrFile);
ostrFile.Close();
} catch(char *strError) {
ErrorMessage(strError);
EnableRendering();
return FALSE;
}
if(bConvert) {
ConvertAnimSet(fnAnimSet);
}
EnableRendering();
return TRUE;
}
示例2: Save_t
void CPlayerCharacter::Save_t( const CTFileName &fnFile) // throw char *
{
CTFileStream strm;
strm.Create_t(fnFile);
Write_t(&strm);
strm.Close();
}
示例3: SaveSmcFile
// Save smc file
void CSeriousSkaStudioApp::SaveSmcFile(CModelInstance &mi,BOOL bSaveChildren)
{
CSeriousSkaStudioDoc *pDoc = GetDocument();
// first get first model instance that has its file
CModelInstance *pmiParent=NULL;
CModelInstance *pmiFirst=&mi;
CTFileName fnSmc = mi.mi_fnSourceFile;
CModelInstance *pfmi = mi.GetFirstNonReferencedParent(GetDocument()->m_ModelInstance);
if(pfmi!=NULL) {
pmiParent = pfmi->GetParent(pDoc->m_ModelInstance);
pmiFirst = pfmi;
fnSmc = pfmi->mi_fnSourceFile;
}
DisableRendering();
try
{
fnSmc.RemoveApplicationPath_t();
}
catch(char *){}
CTFileStream ostrFile;
// try to save model instance
try {
ostrFile.Create_t(fnSmc,CTStream::CM_TEXT);
SaveModelInstance_t(pmiFirst,pmiParent,ostrFile,bSaveChildren);
ostrFile.Close();
NotificationMessage("Smc '%s' saved.",pmiFirst->mi_fnSourceFile);
} catch(char *strError) {
ErrorMessage(strError);
}
EnableRendering();
}
示例4: WriteFont_t
extern void WriteFont_t(CFontData &fdFont, const CImageInfo &iiFont, const CImageInfo &iiGrid, const CTFileName &fnFont)
{
MEX inMex = Max(iiFont.ii_Height,iiFont.ii_Width);
INDEX ctMipmaps = 0;// GetNoOfMipmaps(iiFont.ii_Width,iiFont.ii_Height);
CTFileName fnName = fnFont.NoExt();
try {
fnName.RemoveApplicationPath_t();
} catch(char *) {
}
// save font tga file
iiFont.SaveTGA_t(fnName + ".tga");
iiGrid.SaveTGA_t(fnName + "G.tga");
// create tex file from saved targa
CreateTexture_t( fnName+".tga", fnName+".tex", inMex, ctMipmaps, TEX_CONSTANT);
CreateTexture_t( fnName+"G.tga", fnName+"G.tex", inMex, ctMipmaps);
// set texture source to saved font
fdFont.fd_ptdTextureData = _pTextureStock->Obtain_t(fnName+".tex");
fdFont.fd_ptdTextureData->Reload();
fdFont.fd_ptdTextureData->Force(TEX_CONSTANT); // don't mess with created textures
fdFont.fd_fnTexture = fnName+".tex";
_ptdGrid = _pTextureStock->Obtain_t(fnName + "G.tex");
if(_ptdGrid!=NULL) {
_ptdGrid->Reload();
_ptdGrid->Force(TEX_CONSTANT); // don't mess with created textures
}
// finaly save fnt file
CTFileStream ostr;
ostr.Create_t(fnName + ".fnt");
fdFont.Write_t(&ostr);
}
示例5: CAM_Start
void CAM_Start(const CTFileName &fnmDemo)
{
_bCameraOn = FALSE;
CTFileName fnmScript = fnmDemo.NoExt()+".ini";
if( cam_bRecord) {
try {
_strScript.Create_t(fnmScript);
} catch(char *strError) {
CPrintF("Camera: %s\n", strError);
return;
};
_cp.cp_vPos = FLOAT3D(0,0,0);
_cp.cp_aRot = ANGLE3D(0,0,0);
_cp.cp_aFOV = 90.0f;
_cp.cp_fSpeed = 1;
_cp.cp_tmTick = 0.0f;
} else {
try {
_strScript.Open_t(fnmScript);
} catch(char *strError) {
(void)strError;
return;
};
}
_bCameraOn = TRUE;
_bInitialized = FALSE;
}
示例6: Save_t
/*
* Save entire world (both brushes current state).
*/
void CWorld::Save_t(const CTFileName &fnmWorld) // throw char *
{
// create the file
CTFileStream strmFile;
strmFile.Create_t(fnmWorld);
// save engine build
_pNetwork->WriteVersion_t(strmFile);
// write the world to the file
Write_t(&strmFile);
}
示例7: SaveSettings
static void SaveSettings(const CTFileName &fnConfgin)
{
if(!_bInitialized) return;
try {
CTFileStream ostr;
ostr.Create_t(fnConfgin);
INDEX iVersion=CONFIG_VERSION;
ULONG ulFlags = GetFontFlags();
INDEX iFontSize = GetIntFromControl(IEC_FONT_SIZE);
INDEX iFirstChar = GetIntFromControl(IEC_FIRST_CHAR);
INDEX iLastChar = GetIntFromControl(IEC_LAST_CHAR);
INDEX iAlignH = GetComboIndex(IDC_ALIGN_H);
INDEX iAlignV = GetComboIndex(IDC_ALIGN_V);
INDEX iPaddingX = GetIntFromControl(IEC_PADDINGX);
INDEX iPaddingY = GetIntFromControl(IEC_PADDINGY);
INDEX iWidthAdd = GetIntFromControl(IEC_WIDTH_ADD);
INDEX iHeightAdd = GetIntFromControl(IEC_HEIGHT_ADD);
INDEX ctShadows = GetIntFromControl(IEC_SHADOW_PASSES);
INDEX iTexWidth = GetIntFromControl(ICB_TEX_WIDTH);
INDEX iTexHeight = GetIntFromControl(ICB_TEX_HEIGHT);
const CTString strFontName = GetStringFromControl(ICB_FONT_NAMES);
const CTString strSampleText = GetStringFromControl(IEC_SAMPLE_TEXT);
ostr<<iVersion;
ostr<<ulFlags;
ostr<<iFontSize;
ostr<<iFirstChar;
ostr<<iLastChar;
ostr<<iAlignH;
ostr<<iAlignV;
ostr<<iPaddingX;
ostr<<iPaddingY;
ostr<<iWidthAdd;
ostr<<iHeightAdd;
ostr<<ctShadows;
ostr<<iTexWidth;
ostr<<iTexHeight;
ostr<<strFontName;
ostr<<strSampleText;
ostr<<_bShowTexture;
ostr<<_bShowGrid;
ostr<<_fnCharacterTable;
} catch(char *strErr) {
MessageBox(_hWnd,strErr,0,0);
}
}
示例8: SaveTGA_t
// save TGA routine
void CImageInfo::SaveTGA_t( const CTFileName &strFileName) const // throw char *
{
TGAHeader *pTGAHdr;
UBYTE *pTGABuffer, *pTGAImage;
SLONG slFileSize;
PIX pixBitmapSize = ii_Width*ii_Height;
CTFileStream TGAFile;
// determine and check image info format
SLONG slBytesPerPixel = ii_BitsPerPixel/8;
ASSERT( slBytesPerPixel==3 || slBytesPerPixel==4);
if( slBytesPerPixel!=3 && slBytesPerPixel!=4) throw( TRANS( "Unsupported BitsPerPixel in ImageInfo header."));
// determine TGA file size and allocate memory
slFileSize = sizeof(struct TGAHeader) + pixBitmapSize *slBytesPerPixel;
pTGABuffer = (UBYTE*)AllocMemory( slFileSize);
pTGAHdr = (struct TGAHeader*)pTGABuffer;
pTGAImage = pTGABuffer + sizeof(struct TGAHeader);
// set TGA picture size dimensions
memset( pTGABuffer, 0x0, sizeof(struct TGAHeader));
pTGAHdr->Width = (UWORD)ii_Width;
pTGAHdr->Height = (UWORD)ii_Height;
pTGAHdr->BitsPerPixel = (UBYTE)ii_BitsPerPixel;
pTGAHdr->ImageType = 2;
// flip image vertically
BOOL bAlphaChannel = (slBytesPerPixel==4);
FlipBitmap( ii_Picture, pTGAImage, ii_Width, ii_Height, 1, bAlphaChannel);
// convert CroTeam's pixel format to TGA format
UBYTE *pubTmp = pTGAImage; // need 'walking' pointer
for( INDEX iPix=0; iPix<pixBitmapSize; iPix++)
{ // flip bytes
Swap( pubTmp[0], pubTmp[2]); // R & B channels
pubTmp += slBytesPerPixel;
}
// save entire TGA memory to file and close it
TGAFile.Create_t( strFileName);
TGAFile.Write_t( pTGABuffer, slFileSize);
TGAFile.Close();
// free temorary allocated memory for TGA image format
FreeMemory( pTGABuffer);
}
示例9: CreateTexture
void CDlgCreateSpecularTexture::CreateTexture( CTFileName fnTexture, FLOAT fExp)
{
CImageInfo II;
CTFileStream fsFile;
CTextureData TD;
INDEX iSelectedSize = m_comboSizeInPixels.GetCurSel();
ASSERT( iSelectedSize != CB_ERR);
PIX pixSize = 1UL<<iSelectedSize;
PIX pixSizeI = pixSize;
PIX pixSizeJ = pixSize;
UBYTE *pubImage = (UBYTE *)AllocMemory(pixSize*pixSize*3);
II.Attach(pubImage, pixSize, pixSize, 24);
for (PIX pixI=0; pixI<pixSizeI; pixI++) {
for (PIX pixJ=0; pixJ<pixSizeJ; pixJ++) {
FLOAT fS = pixI*2.0f/pixSizeI-1;
FLOAT fT = pixJ*2.0f/pixSizeJ-1;
FLOAT fZ = Sqrt(1-2*fS*fS-2*fT*fT);
fZ = Clamp(fZ, 0.0f, 1.0f);
FLOAT fZN = FLOAT(pow(fZ, fExp));
ASSERT(fZN>=0 && fZN<=1);
UBYTE ub = UBYTE(fZN*255);
pubImage[(pixJ*pixSize+pixI)*3+0] = ub;
pubImage[(pixJ*pixSize+pixI)*3+1] = ub;
pubImage[(pixJ*pixSize+pixI)*3+2] = ub;
}
}
try
{
TD.Create_t( &II, pixSize, 1, FALSE);
fsFile.Create_t( fnTexture);
TD.Write_t( &fsFile);
fsFile.Close();
}
// if failed
catch (char *strError)
{
// report error
AfxMessageBox(CString(strError));
}
II.Detach();
FreeMemory(pubImage);
}
示例10: SaveSkeletonListFile
// save skeleton list file
BOOL CSeriousSkaStudioApp::SaveSkeletonListFile(CSkeleton &skl, BOOL bConvert)
{
DisableRendering();
CTFileName fnSkeletonList = skl.GetName();
fnSkeletonList = fnSkeletonList.NoExt() + ".asl";
try {
fnSkeletonList.RemoveApplicationPath_t();
}
catch(char *){}
// back up current skeleton list file
CTString strBackUp;
try {
strBackUp.Load_t(fnSkeletonList);
}
catch(char*){}
CTFileStream ostrFile;
try {
ostrFile.Create_t(fnSkeletonList,CTStream::CM_TEXT);
SaveSkeletonList_t(skl,ostrFile);
ostrFile.Close();
} catch(char *strError) {
ErrorMessage(strError);
EnableRendering();
return FALSE;
}
if(bConvert) {
if(!ConvertSkeleton(fnSkeletonList)) {
// convert failed
if(strBackUp.Length()>0) {
// try returning old mesh list file
try {
strBackUp.Save_t(fnSkeletonList);
}
catch(char*){}
}
}
}
EnableRendering();
return TRUE;
}
示例11: SaveMeshListFile
// save mesh list file
BOOL CSeriousSkaStudioApp::SaveMeshListFile(MeshInstance &mshi, BOOL bConvert)
{
DisableRendering();
// get mesh list filename
CTFileName fnMeshList = mshi.mi_pMesh->GetName();
fnMeshList = fnMeshList.NoExt() + ".aml";
try {
fnMeshList.RemoveApplicationPath_t();
} catch(char *){}
CTString strBackUp;
try {
// back up current mesh list file
strBackUp.Load_t(fnMeshList);
} catch(char*){}
// save mesh instance in new mesh list file
CTFileStream ostrFile;
try {
ostrFile.Create_t(fnMeshList,CTStream::CM_TEXT);
SaveMeshInstance_t(mshi,ostrFile);
ostrFile.Close();
} catch(char *strError) {
ErrorMessage(strError);
EnableRendering();
return FALSE;
}
// if new mesh list file needs to be converted
if(bConvert) {
if(!ConvertMesh(fnMeshList)) {
// convert failed
if(strBackUp.Length()>0) {
// try returning old mesh list file
try {
strBackUp.Save_t(fnMeshList);
} catch(char*){}
}
}
}
EnableRendering();
return TRUE;
}