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


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

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


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

示例1: module

CUnixDynamicLoader::CUnixDynamicLoader(const char *libname)
    : module(NULL),
      err(NULL)
{
    if (libname == NULL) {
        DoOpen(NULL);
    } else {
        CTFileName fnm = ConvertLibNameToPlatform(libname);

        // Always try to dlopen from inside the game dirs before trying
        //  system libraries...
        if (fnm.FileDir() == "") {
            char buf[MAX_PATH];
            _pFileSystem->GetExecutablePath(buf, sizeof (buf));
            CTFileName fnmDir = CTString(buf);
            fnmDir = fnmDir.FileDir() + fnm;
            DoOpen(fnmDir);
            if (module != NULL) {
                return;
            }
        }

        DoOpen(fnm);
    }
}
开发者ID:DrItanium,项目名称:Serious-Engine,代码行数:25,代码来源:UnixDynamicLoader.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: 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

示例5: 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

示例6: 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

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