当前位置: 首页>>代码示例>>C++>>正文


C++ CTFileName::FileName方法代码示例

本文整理汇总了C++中CTFileName::FileName方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFileName::FileName方法的具体用法?C++ CTFileName::FileName怎么用?C++ CTFileName::FileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTFileName的用法示例。


在下文中一共展示了CTFileName::FileName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Read_t

// Read from stream
void CShader::Read_t(CTStream *istrFile)
{
  // read the dll filename and class name from the stream
  CTFileName fnmDLL;
  CTString strShaderFunc;
  CTString strShaderInfo;

  fnmDLL.ReadFromText_t(*istrFile, "Package: ");
  strShaderFunc.ReadFromText_t(*istrFile, "Name: ");
  strShaderInfo.ReadFromText_t(*istrFile, "Info: ");

  // create name of dll
  #ifndef NDEBUG
    fnmDLL = _fnmApplicationExe.FileDir()+fnmDLL.FileName()+/*_strModExt+*/"D"+fnmDLL.FileExt();
  #else
    fnmDLL = _fnmApplicationExe.FileDir()+fnmDLL.FileName()+/*_strModExt+*/fnmDLL.FileExt();
  #endif

  CTFileName fnmExpanded;
  ExpandFilePath(EFP_READ | EFP_NOZIPS,fnmDLL,fnmExpanded);
  // set new error mode
  UINT iOldErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX|SEM_FAILCRITICALERRORS);
  // load dll
  hLibrary = LoadLibraryA((const char*)fnmExpanded);
  // return last error mode
  SetErrorMode(iOldErrorMode);
  // check if library has loaded
  if(hLibrary==NULL)
  {
    // report error
    istrFile->Throw_t("Error loading '%s' library",(const char*)fnmExpanded);
    return;
  }
  // get pointer to shader render function
  ShaderFunc = (void(*)(void))GetProcAddress(hLibrary,(const char*)strShaderFunc);
  // if error accured
  if(ShaderFunc==NULL)
  {
    // report error
    istrFile->Throw_t("GetProcAddress 'ShaderFunc' Error");
  }
  // get pointer to shader info function
  GetShaderDesc = (void(*)(ShaderDesc&))GetProcAddress(hLibrary,(const char*)strShaderInfo);
  // if error accured
  if(GetShaderDesc==NULL) {
    // report error
    istrFile->Throw_t("GetProcAddress 'ShaderDesc' Error");
  }
}
开发者ID:0-T-0,项目名称:Serious-Engine,代码行数:50,代码来源:Shader.cpp

示例2: BrowseAttachement

BOOL CDlgPgInfoAttachingPlacement::BrowseAttachement( CAttachedModel *pam)
{
  CModelerView *pModelerView = CModelerView::GetActiveView();
  if(pModelerView == NULL) return FALSE;
  CModelerDoc* pDoc = pModelerView->GetDocument();

  CTFileName fnOldModel = pam->am_moAttachedModel.GetName();
  CTFileName fnModel = _EngineGUI.FileRequester( "Select model to attach",
				  FILTER_MDL FILTER_END, "Attaching models directory",
				  _fnmApplicationPath + fnOldModel.FileDir(),
				  fnOldModel.FileName()+fnOldModel.FileExt());
  if( fnModel == "") return FALSE;

  try
  {
    pam->SetModel_t( fnModel);
  }
  catch( char *strError)
  {
    (void) strError;
    return FALSE;
  }
  pam->am_bVisible = TRUE;

  pDoc->ClearAttachments();
  pDoc->SetupAttachments();

  pDoc->SetModifiedFlag();
  pDoc->UpdateAllViews( NULL);

  UpdateData(FALSE);
  return TRUE;
}
开发者ID:ArcticPheenix,项目名称:Serious-Engine,代码行数:33,代码来源:DlgPgInfoAttachingPlacement.cpp

示例3: OnScriptUpdateMipmodels

void CScriptView::OnScriptUpdateMipmodels() 
{
	// find document with same name
  CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
  CTFileName fnScriptName = CTString(pDoc->GetPathName());
  CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";

	POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
    {
      POSITION pos = pmdCurrent->GetFirstViewPosition();
      CView *pView = pmdCurrent->GetNextView( pos);
      if( DYNAMIC_DOWNCAST(CModelerView, pView) != NULL)
      {
        CModelerView* pModelerView = (CModelerView *) pView;
        if(pModelerView != NULL)
        {
          pModelerView->OnScriptUpdateMipmodels();
          pModelerView->SetActiveWindow();
          pModelerView->SetFocus();
          CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
          pMainFrame->MDIActivate(pModelerView->GetParentFrame());
        }
      }
      break;
    }
  }
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:31,代码来源:ScriptView.cpp

示例4: OnBrowseBcgPicture

void CDlgRenderingPreferences::OnBrowseBcgPicture() 
{
  CTFileName fnBcgPicture = _EngineGUI.FileRequester( "Select background texture",
    "Texture (*.tex)\0*.tex\0" FILTER_TEX FILTER_END, "Background textures", "");
  if( fnBcgPicture == "") return;
  sprintf( theApp.m_vpViewPrefs[ m_iBuffer].m_achrBcgPicture, "%s", fnBcgPicture);
  m_strBcgTexture = fnBcgPicture.FileName();
  UpdateData( FALSE);
}
开发者ID:EgoIncarnate,项目名称:Serious-Engine,代码行数:9,代码来源:DlgRenderingPreferences.cpp

示例5: ConvertLibNameToPlatform

CTFileName CDynamicLoader::ConvertLibNameToPlatform(const char *libname)
{
    #if PLATFORM_MACOSX
    const char *DLLEXTSTR = ".dylib";
    #else
    const char *DLLEXTSTR = ".so";
    #endif
    CTFileName fnm = CTString(libname);
    CTString libstr((strncmp("lib", fnm.FileName(), 3) == 0) ? "" : "lib");
    return(fnm.FileDir() + libstr + fnm.FileName() + DLLEXTSTR);
}
开发者ID:DrItanium,项目名称:Serious-Engine,代码行数:11,代码来源:UnixDynamicLoader.cpp

示例6: GetLevelInfo

// get level info for given filename
BOOL GetLevelInfo(CLevelInfo &li, const CTFileName &fnm)
{
  // try to
  try {
    // open the world file
    CTFileStream strm;
    strm.Open_t(fnm);
    // skip initial chunk ids
    strm.ExpectID_t("BUIV"); // 'build version'
    INDEX iDummy;
    strm>>iDummy; // the version number
    strm.ExpectID_t("WRLD"); // 'world'
    strm.ExpectID_t("WLIF"); // 'world info'
    if (strm.PeekID_t()==CChunkID("DTRS")) {
      strm.ExpectID_t("DTRS"); // 'world info'
    }
    // read the name
    strm>>li.li_strName;
    // read the flags
    strm>>li.li_ulSpawnFlags;

    // translate name
    li.li_strName = TranslateConst(li.li_strName, 0);

    // if dummy name
    if (li.li_strName=="") {
      // use filename
      li.li_strName = fnm.FileName();
    }

    // remember filename
    li.li_fnLevel = fnm;

    // succeed
    return TRUE;

  // if failed
  } catch (char *strError) {
    (void) strError;
    //CPrintF("Invalid world file '%s': %s\n", (const char*) fnm, strError);
    // set dummy info
    li = CLevelInfo();
    // fail
    return FALSE;
  }
}
开发者ID:bsmr-games,项目名称:Serious-Engine,代码行数:47,代码来源:LevelInfo.cpp

示例7: OnShowWindow

void CDlgClient::OnShowWindow(BOOL bShow, UINT nStatus) 
{
  CComboBox *cbShader = ((CComboBox*)GetDlgItem(IDC_CB_SHADER));
  if((bShow==TRUE) && (cbShader!=NULL))
  {
    // read all shaders files
    CDynamicStackArray<CTFileName> afnShaders;
    MakeDirList( afnShaders, CTString("Shaders\\"), "*.sha", 0);
    cbShader->ResetContent();
    for(INDEX ifn=0; ifn<afnShaders.Count(); ifn++)
    {
      CTFileName fnShader = afnShaders[ifn];
      cbShader->AddString(CString(fnShader.FileName()));
    }
  }
	CDialog::OnShowWindow(bShow, nStatus);
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:17,代码来源:DlgClient.cpp

示例8: OnFileAddTexture

void CModelerDoc::OnFileAddTexture() 
{
  CModelerView *pModelerView = CModelerView::GetActiveView();
  if( pModelerView == NULL)
    return;

  // call file requester for adding textures
  CDynamicArray<CTFileName> afnTextures;
  CTFileName fnDocName = CTString(GetPathName());
  theApp.WriteProfileString( "Scape", "Add texture directory", fnDocName.FileDir());
  _EngineGUI.FileRequester( "Choose textures to add", FILTER_TEX FILTER_END,
    "Add texture directory", "Textures\\", fnDocName.FileName()+".tex", &afnTextures);
  MEX mexWidth, mexHeight;
  m_emEditModel.edm_md.GetTextureDimensions( mexWidth, mexHeight);
  // add selected textures
  FOREACHINDYNAMICARRAY( afnTextures, CTFileName, itTexture)
  {
    CTextureDataInfo *pNewTDI;
    // add texture
    CTFileName fnTexName = itTexture.Current();
    try
    {
      pNewTDI =m_emEditModel.AddTexture_t( fnTexName, mexWidth, mexHeight);
    }
    catch( char *err_str)
    {
      pNewTDI = NULL;
      AfxMessageBox( err_str);
    }
    if( pNewTDI != NULL)
    {
      SetModifiedFlag();
      pModelerView->m_ptdiTextureDataInfo = pNewTDI;
      // switch to texture mode
      pModelerView->OnRendUseTexture();
      UpdateAllViews( NULL);
    }
  }
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:38,代码来源:ModelerDoc.cpp

示例9: StartSplitScreenGame

void StartSplitScreenGame(void)
{
  //  _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
  _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;

  _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
  _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
  _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
  _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];

  CTFileName fnWorld = _pGame->gam_strCustomLevel;

  _pGame->gm_strNetworkProvider = "Local";
  CUniversalSessionProperties sp;
  _pGame->SetMultiPlayerSession(sp);
  if (_pGame->NewGame(fnWorld.FileName(), fnWorld, sp))
  {
    StopMenus();
    _gmRunningGameMode = GM_SPLIT_SCREEN;
  } else {
    _gmRunningGameMode = GM_NONE;
  }
}
开发者ID:Bryceless,项目名称:Serious-Engine,代码行数:23,代码来源:MenuStarters.cpp

示例10: LoadCharTable

static void LoadCharTable(const CTFileName &fnCharTable) {
  if(fnCharTable.Length() == 0) {
    ClearCharTable();
    return;
  }

  try {
    SetDlgItemText(_hWnd,IDC_CHARACTER_TABLE,(const char*)(fnCharTable.FileName() + fnCharTable.FileExt()));
    _strCharTable.Load_t(fnCharTable);
    INDEX iLen = _strCharTable.Length();
    memset(&_aubCharTable[0],0,sizeof(_aubCharTable));

    for(INDEX ic=0;ic<iLen;ic++) {
      unsigned char ch = _strCharTable[ic];
      _aubCharTable[ch] = 1;
    }
    _aubCharTable[10] = 0;
    _aubCharTable[13] = 0;
    _fnCharacterTable = fnCharTable;
  } catch(char *strErr) {
    MessageBox(_hWnd,strErr,0,0);
  }
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:23,代码来源:FontGen.cpp

示例11: CDialog

CDlgCreateNormalTexture::CDlgCreateNormalTexture( CTFileName fnInputFile, CWnd* pParent /*=NULL*/)
	: CDialog(CDlgCreateNormalTexture::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgCreateNormalTexture)
	m_strCreatedTextureName = _T("");
	m_strSizeInPixels = _T("");
	m_bCreateMipmaps = FALSE;
	//}}AFX_DATA_INIT

  m_bSourcePictureValid = FALSE;
  m_bPreviewWindowsCreated = FALSE;
  m_ptdCreated = NULL;
  
  CTFileName fnTexFileName = fnInputFile.FileDir() + fnInputFile.FileName() + ".tex";
  // remember source and created texture name
  m_fnSourceFileName  = fnInputFile;
  m_fnCreatedFileName = fnTexFileName;
  // set initial values for create mip maps flag and size for create texture dialog
  m_bCreateMipmaps  = AfxGetApp()->GetProfileInt(L"Creating textures", L"Create mipmaps", 1);
  m_mexCreatedWidth = AfxGetApp()->GetProfileInt(L"Creating textures", L"Mex width",  -1);
  _bWasForced32     = FALSE;

  try
  {
    // if can't get picture file information
    CImageInfo iiImageInfo;
    if (iiImageInfo.GetGfxFileInfo_t( m_fnSourceFileName)==UNSUPPORTED_FILE)
    {
      // throw error
      ThrowF_t("File '%s' has unsupported file format", 
        (CTString&)(_fnmApplicationPath+m_fnSourceFileName));
    }
    // get dimensions
    m_pixSourceWidth  = iiImageInfo.ii_Width;
    m_pixSourceHeight = iiImageInfo.ii_Height;
    // test if dimensions are at power of 2
    if( (((1<<((int)Log2(m_pixSourceWidth)))  != m_pixSourceWidth)) ||
        (((1<<((int)Log2(m_pixSourceHeight))) != m_pixSourceHeight))) {
      ThrowF_t( "Picture %s has wrong dimensions (%d,%d).\n"
                "Both width and height must be at power of 2.",
                (CTString&)m_fnSourceFileName, m_pixSourceWidth, m_pixSourceHeight);
    }
  }
  catch(char *err_str)
  {
    AfxMessageBox( CString(err_str));
    return;
  }
  m_bSourcePictureValid = TRUE;

  // try to
  try
  { // obtain texture with the same name (if already exists)
    CTextureData *pTD = _pTextureStock->Obtain_t( fnTexFileName);
    pTD->Reload();
    // now pick up initial number of mip levels
    m_bCreateMipmaps = pTD->td_ctFineMipLevels>1;
    // remember existing texture's width in mexels
    m_mexCreatedWidth = pTD->GetWidth();
    // remember existing texture's flags
    _bWasForced32 = pTD->td_ulFlags & TEX_32BIT;
    // release texture
    _pTextureStock->Release( pTD);
  }
  // if texture can't be obtained
  catch( char *err_str)
  { // never mind
    (void) err_str;
  }

  m_wndViewCreatedTexture.m_bForce32 = FALSE;
  if( _bWasForced32) m_wndViewCreatedTexture.m_bForce32 = TRUE;
  RefreshCreatedTexture();
  // set created texture name
  m_strCreatedTextureName = fnTexFileName;
  // prepare string telling size of source picture
  char strSize[ 64];
  sprintf( strSize, "%d x %d", m_pixSourceWidth, m_pixSourceHeight);
  m_strSizeInPixels = strSize;
} 
开发者ID:0-T-0,项目名称:Serious-Engine,代码行数:80,代码来源:DlgCreateNormalTexture.cpp

示例12: OnSaveDocument

BOOL CModelerDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
	//return CDocument::OnSaveDocument(lpszPathName);
  CTFileName fnModelFile = CTString(lpszPathName);
  try
  {
    fnModelFile.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return FALSE;
  }

#if BUILD_PUBLISHER
  WarningMessage(
    "Saving is disabled in this version!");
  return FALSE;
#else
  try
  {
  	m_emEditModel.Save_t( fnModelFile);
    m_emEditModel.SaveMapping_t( fnModelFile.NoExt()+".map", 0);
  }
  catch( char *err_str)
  {
    MessageBoxA(pMainFrame->m_hWnd, err_str, "Warning! Model Save failed.", MB_OK|MB_ICONHAND|MB_SYSTEMMODAL);
    return FALSE;
  }
  SetModifiedFlag( FALSE);

  CModelerView *pModelerView = CModelerView::GetActiveView();
  if( pModelerView != NULL)
  {
    pModelerView->SaveThumbnail();
  }

  // reload attachments of all loaded models 
  POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( pmdCurrent != this)
    {
      BOOL bUpdateAttachments = TRUE;
      
      // if document is modified
      if( pmdCurrent->IsModified())
      {
        CTString strMessage;
        CTFileName fnDoc = CTString(pmdCurrent->GetPathName());
        strMessage.PrintF("Do you want to save model \"%s\" before reloading its attachments?", fnDoc.FileName() );
        if( ::MessageBox( pMainFrame->m_hWnd, strMessage,
                        "Warning !", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON1 | 
                        MB_TASKMODAL | MB_TOPMOST) != IDYES)
        {
          bUpdateAttachments = FALSE;
        }
        // save document
        else
        {
          pmdCurrent->OnSaveDocument(pmdCurrent->GetPathName());
        }
      }

      if( bUpdateAttachments)
      {
        POSITION pos = pmdCurrent->GetFirstViewPosition();
        while (pos != NULL)
        {
          CView* pView = GetNextView(pos);
          ((CModelerView *)pView)->m_ModelObject.AutoSetAttachments();
          
          //CModelData *pmd = (CModelData *) ((CModelerView *)pView)->m_ModelObject.GetData();
          //pmd->Reload();
        }
      }
    }
  }


  return TRUE;
#endif
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:85,代码来源:ModelerDoc.cpp

示例13: OnScriptMakeModel

void CScriptView::OnScriptMakeModel() 
{
	// First we save script file
  CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
  CTFileName fnScriptName = CTString(pDoc->GetPathName());

  CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";
  try
  {
    fnScriptName.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return;
  }
  pDoc->OnSaveDocument( pDoc->GetPathName());

	// close mdl document with same name
  POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
    {
      pmdCurrent->OnCloseDocument();
      break;
    }
  }

	// Now we will create one instance of new document of type CModelerDoc
  CDocument* pDocument = theApp.m_pdtModelDocTemplate->CreateNewDocument();
 	if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return;
	}
	ASSERT_VALID(pDocument);
	
  BOOL bAutoDelete = pDocument->m_bAutoDelete;
	pDocument->m_bAutoDelete = FALSE;   // don't destroy if something goes wrong
	CFrameWnd* pFrame = theApp.m_pdtModelDocTemplate->CreateNewFrame(pDocument, NULL);
	pDocument->m_bAutoDelete = bAutoDelete;
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return;
	}
	ASSERT_VALID(pFrame);

  pDocument->SetPathName( fnModelName, FALSE);
  pDocument->SetTitle( fnModelName.FileName() + fnModelName.FileExt());
  
  char strError[ 256];
  if( !((CModelerDoc *)pDocument)->CreateModelFromScriptFile( fnScriptName, strError))
  {
    pDocument->OnCloseDocument();
    AfxMessageBox( strError);
    return;
  }
	theApp.m_pdtModelDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
  ((CModelerDoc *)pDocument)->m_emEditModel.edm_md.md_bPreparedForRendering = FALSE;
  pDocument->SetModifiedFlag();

  // add textures from .ini file
  CTFileName fnIniFileName = fnScriptName.NoExt() + ".ini";
  try
  {
    ((CModelerDoc *)pDocument)->m_emEditModel.CSerial::Load_t(fnIniFileName);
  }
  catch( char *strError)
  {
    // ignore errors
    (void) strError;
  }
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:78,代码来源:ScriptView.cpp


注:本文中的CTFileName::FileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。