Back to index

nux  3.0.0
Public Member Functions | Private Member Functions | Private Attributes
nux::NuxGraphicsResources Class Reference

#include <NuxGraphicsResources.h>

Collaboration diagram for nux::NuxGraphicsResources:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void InitializeResources ()
NString FindResourceLocation (const char *ResourceFileName, bool ErrorOnFail=false)
NString FindUITextureLocation (const char *ResourceFileName, bool ErrorOnFail=false)
NString FindShaderLocation (const char *ResourceFileName, bool ErrorOnFail=false)
NString FindFontLocation (const char *ResourceFileName, bool ErrorOnFail=false)

Private Member Functions

 NUX_DECLARE_GLOBAL_OBJECT (NuxGraphicsResources, NuxGraphicsGlobalSingletonInitializer)

Private Attributes

std::vector< NStringm_FontSearchPath
std::vector< NStringm_ShaderSearchPath
std::vector< NStringm_UITextureSearchPath
FilePath m_ResourcePathLocation

Detailed Description

Definition at line 31 of file NuxGraphicsResources.h.


Member Function Documentation

NString nux::NuxGraphicsResources::FindFontLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)
NString nux::NuxGraphicsResources::FindResourceLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)
NString nux::NuxGraphicsResources::FindShaderLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)
NString nux::NuxGraphicsResources::FindUITextureLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)

Definition at line 42 of file NuxGraphicsResources.cpp.

  {
//         FilePath m_FilePath;
//         m_FilePath.AddSearchPath(""); // for case where fully qualified path is given
//         m_FilePath.AddSearchPath("./ini");
//         m_FilePath.AddSearchPath("../ini");
//         m_FilePath.AddSearchPath("../../ini");
//         m_FilePath.AddSearchPath("../../../ini");
//
//
//         NString file_search = "inalogic.ini";
//         NString FileName = m_FilePath.GetFile(file_search.GetTCharPtr());
//         if (FileName == "")
//         {
//             nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Can't find inalogic.ini file.");
// //             exit(-1);
//         }
//
//         if (FileName != "")
//         {
//             NString key_name = "UseBackupFBO";
//             NString section_name = "OpenGLSystem";
//
//             if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()) == false)
//             {
//                 nuxDebugMsg("[GraphicsDisplay::GraphicsDisplay] Key [%s] does not exit in .ini file.");
//             }
//             else
//             {
//                 bool m_BackupFrameBuffer;
//                 NString value = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
//                 if ((value == "1") || (value == "true"))
//                 {
//                     m_BackupFrameBuffer = true;
//                 }
//                 else
//                 {
//                     m_BackupFrameBuffer = false;
//                 }
//             }
//
//             section_name = "SearchPath";
//             key_name = "FontPath";
//             if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()))
//             {
//                 NString FontPath = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
//                 FontPath.ParseToArray(m_FontSearchPath, ";");
//             }
//             else
//             {
//                 nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Failed to read font search path from .ini file.");
// //                 return;
//
//             }
//
//             key_name = "UITexturePath";
//             if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()))
//             {
//                 NString UITexturePath = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
//                 UITexturePath.ParseToArray(m_UITextureSearchPath, ";");
//             }
//             else
//             {
//                 nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Failed to read texture search path from .ini file.");
// //                 return;
//             }
//
//             key_name = "ShaderPath";
//             if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()))
//             {
//                 NString ShaderPath = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
//                 ShaderPath.ParseToArray(m_ShaderSearchPath, ";");
//             }
//             else
//             {
//                 nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Failed to read shader search path from .ini file.");
// //                 return;
//             }
//         }

#ifdef NUX_OS_LINUX
    m_ResourcePathLocation.AddSearchPath(PKGDATADIR);
    m_ResourcePathLocation.AddSearchPath(PKGDATADIR"/Fonts");
    m_ResourcePathLocation.AddSearchPath(PKGDATADIR"/Meshes");
    m_ResourcePathLocation.AddSearchPath(PKGDATADIR"/UITextures");

#ifdef NUX_DEBUG
    /* For examples */
    m_ResourcePathLocation.AddSearchPath("../data");
    m_ResourcePathLocation.AddSearchPath("../data/Fonts");
    m_ResourcePathLocation.AddSearchPath("../data/Meshes");
    m_ResourcePathLocation.AddSearchPath("../data/UITextures");
#endif

#else
    m_ResourcePathLocation.AddSearchPath("");
    m_ResourcePathLocation.AddSearchPath("./");
    m_ResourcePathLocation.AddSearchPath("../");
    m_ResourcePathLocation.AddSearchPath("../../");
    m_ResourcePathLocation.AddSearchPath("./Data");
    m_ResourcePathLocation.AddSearchPath("../Data");
    m_ResourcePathLocation.AddSearchPath("../../Data");
    m_ResourcePathLocation.AddSearchPath("../../../Data");
    m_ResourcePathLocation.AddSearchPath("./Data/Fonts");
    m_ResourcePathLocation.AddSearchPath("../Data/Fonts");
    m_ResourcePathLocation.AddSearchPath("../../Data/Fonts");
    m_ResourcePathLocation.AddSearchPath("../../../Data/Fonts");
    m_ResourcePathLocation.AddSearchPath("./Data/UITextures");
    m_ResourcePathLocation.AddSearchPath("../Data/UITextures");
    m_ResourcePathLocation.AddSearchPath("../../Data/UITextures");
    m_ResourcePathLocation.AddSearchPath("../../../Data/UITextures");
#endif

    m_ResourcePathLocation.AddSearchPath(m_FontSearchPath);
    m_ResourcePathLocation.AddSearchPath(m_ShaderSearchPath);
    m_ResourcePathLocation.AddSearchPath(m_UITextureSearchPath);
  }

Here is the call graph for this function:


Member Data Documentation

Definition at line 44 of file NuxGraphicsResources.h.

Definition at line 47 of file NuxGraphicsResources.h.

Definition at line 45 of file NuxGraphicsResources.h.

Definition at line 46 of file NuxGraphicsResources.h.


The documentation for this class was generated from the following files: