CORE::CString
GetUniqueFileName( const CORE::CString& filename )
{GUCEF_TRACE;

    CORE::CString fileExt = CORE::ExtractFileExtention( filename );
    CORE::CString fileWithoutExt;

    if ( fileExt.IsNULLOrEmpty() )
    {
        fileWithoutExt = filename;
    }
    else
    {
        fileWithoutExt = filename.CutChars( fileExt.Length()+1, false );
    }

    CORE::UInt32 i = 2;
    CORE::CString filenameToTest = filename;
    while ( CORE::FileExists( filenameToTest ) )
    {
        filenameToTest = fileWithoutExt + '(' + CORE::UInt32ToString( i ) + ")." + fileExt;
        ++i;
    }

    return filenameToTest;
}
Example #2
0
bool
LoadConfig( const CORE::CString& configPath ,
            CORE::CValueList& keyValueList  )
{GUCEF_TRACE;

    #ifdef GUCEF_DEBUG_MODE
    const CORE::CString configFile = "ProjectGenerator_d.ini";
    #else
    const CORE::CString configFile = "ProjectGenerator.ini";
    #endif

    CORE::CString configFilePath;
    bool foundViaParam = false;
    if ( !configPath.IsNULLOrEmpty() )
    {
        GUCEF_LOG( CORE::LOGLEVEL_BELOW_NORMAL, "Checking for config file @ " + configPath );
        foundViaParam = CORE::FileExists( configPath );
        configFilePath = configPath;
    }

    if ( !foundViaParam )
    {
        CORE::CString configFilePath = CORE::CombinePath( "$CURWORKDIR$", configFile );
        configFilePath = CORE::RelativePath( configFilePath );

        GUCEF_LOG( CORE::LOGLEVEL_BELOW_NORMAL, "Checking for config file @ " + configFilePath );
        if ( !CORE::FileExists( configFilePath ) )
        {
            configFilePath = CORE::CombinePath( "$MODULEDIR$", configFile );
            configFilePath = CORE::RelativePath( configFilePath );

            GUCEF_LOG( CORE::LOGLEVEL_BELOW_NORMAL, "Checking for config file @ " + configFilePath );
            if ( !FileExists( configFilePath ) )
            {
                GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "Unable to locate any config file, will rely on params" );
                return false;
            }
        }
    }
    GUCEF_LOG( CORE::LOGLEVEL_NORMAL, "Located config file @ " + configFilePath );

    keyValueList.SetConfigNamespace( "Bootstrap/Main/AppArgs" );
    keyValueList.SetUseGlobalConfig( true );
    keyValueList.SetAllowDuplicates( false );
    keyValueList.SetAllowMultipleValues( true );

    CORE::CConfigStore& configStore = CORE::CCoreGlobal::Instance()->GetConfigStore();
    configStore.SetConfigFile( configFilePath );
    return configStore.LoadConfig();
}
bool
CResArchive::LoadArchive( const VFS::CString& archiveName ,
                          const VFS::CString& archivePath ,
                          const bool writableRequest      )
{GUCEF_TRACE;

    // We do not support writable archives
    if ( writableRequest ) return false;

    // Since we always need both the index file and the resource file
    // already construct the paths for both

    CORE::CString fileExt = CORE::ExtractFileExtention( archivePath ).Uppercase();
    if ( fileExt.IsNULLOrEmpty() )
    {
        m_idxPath = m_resPath = archivePath;
        m_idxPath += ".IDX";
        m_resPath += ".RES";
    }
    else
    if ( fileExt.Equals( "RES", false ) )
    {
        m_resPath = archivePath;
        m_idxPath = archivePath.CutChars( 4, false, 0 ) + ".IDX";
    }
    else
    if ( fileExt.Equals( "IDX", false ) )
    {
        m_idxPath = archivePath;
        m_resPath = archivePath.CutChars( 4, false, 0 ) + ".RES";
    }

    m_archiveName = archiveName;
    m_archivePath = archivePath;

    return LoadIndex();
}
bool
CPatcherAppConfig::LoadConfig( const CORE::CDataNode& treeroot )
{GUCEF_TRACE;

    CORE::CDataNode::TConstDataNodeSet configNodes( treeroot.FindChildrenOfType( "PatcherAppConfig", true ) );
    CORE::CDataNode::TConstDataNodeSet::iterator i = configNodes.begin();
    if ( i != configNodes.end() )
    {
        const CORE::CDataNode* configNode = (*i);

        CORE::CString value = configNode->GetAttributeValueOrChildValueByName( "LogFilePath" );
        if ( !value.IsNULLOrEmpty() )
        {
            m_logfilePath = value;
        }
        value = configNode->GetAttributeValueOrChildValueByName( "IsFileLoggerEnabled" );
        if ( !value.IsNULLOrEmpty() )
        {
            m_isFileLoggerEnabled = CORE::StringToBool( value );
        }
        value = configNode->GetAttributeValueOrChildValueByName( "IsConsoleLoggerEnabled" );
        if ( !value.IsNULLOrEmpty() )
        {
            m_isConsoleLoggerEnabled = CORE::StringToBool( value );
        }
        value = configNode->GetAttributeValueOrChildValueByName( "IsConsoleWindowEnabled" );
        if ( !value.IsNULLOrEmpty() )
        {
            m_isConsoleWindowEnabled = CORE::StringToBool( value );
        }

        value = configNode->GetAttributeValueOrChildValueByName( "WindowManager" );
        if ( !value.IsNULLOrEmpty() )
        {
            m_windowManagerName = value;
        }

        CORE::CDataNode::TConstDataNodeSet nodeSet( configNode->FindChildrenOfType( "InitialForm", true ) );
        CORE::CDataNode::TConstDataNodeSet::iterator n = nodeSet.begin();
        if ( n != nodeSet.end() )
        {
            const CORE::CDataNode* formInfoNode = (*n);

            m_guiBackendName = formInfoNode->GetAttributeValueOrChildValueByName( "GuiBackend" );
            if ( !m_guiBackendName.IsNULLOrEmpty() )
            {
                m_initialFormTypeName = formInfoNode->GetChildValueByName( "FormTypeName" );
                m_initialFormResourcePath = formInfoNode->GetChildValueByName( "FormResource" );
            }
        }

        nodeSet = configNode->FindChildrenOfType( "FontsToLoadFromAssets", true );
        n = nodeSet.begin();
        while ( n != nodeSet.end() )
        {
            const CORE::CDataNode* fontInfoNode = (*n);
            CString fontAsset = fontInfoNode->GetAttributeValueOrChildValueByName( "FontAsset" );
            if ( !fontAsset.IsNULLOrEmpty() )
            {
                m_fontAssetsToLoad.push_back( fontAsset );
            }
            ++n;
        }

    }
    return true;
}
CEGUI::Texture* 
ImageCodecAdapter::load( const CEGUI::RawDataContainer& data , 
                         CEGUI::Texture* result              )
{GUCEF_TRACE;

    if ( NULL == result ) 
    {
        GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: Unable to load texture since no texture object was provided" );
        return NULL;
    }

    CORE::CString imgType = CORE::ExtractFileExtention( result->getName() );
    if ( imgType.IsNULLOrEmpty() )
    {
        if ( NULL != m_vfsResourceProvider )
        {
            VfsResourceProvider::DataContainerInfoPtr containerInfo = m_vfsResourceProvider->GetInfoOnLoadedContainer( data );
            if ( !containerInfo.IsNULL() )
            {
                imgType = CORE::ExtractFileExtention( containerInfo->requestFilename );
            }
        }
    }

    if ( imgType.IsNULLOrEmpty() )
    {
        GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: Unable to load texture since no image type could be derived from the the texture name" );
        return NULL;
    }

    IMAGE::CImageCodecRegistry& codecRegistry = IMAGE::CImageGlobal::Instance()->GetImageCodecRegistry();
    
    IMAGE::CImageCodecRegistry::TImageCodecPtr codec;
    if ( !codecRegistry.TryLookup( imgType, codec ) )
    {
        GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: Unable to load texture since no image codec could be found for type: " + imgType );
        return NULL;
    }

    CORE::CDynamicBufferAccess bufferAccess;
    bufferAccess.LinkTo( data.getDataPtr(), data.getSize() );

    IMAGE::CImage image;
    if ( !codec->Decode( bufferAccess, image ) )
    {
        GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: Unable to load texture since the image codec decoding failed for type: " + imgType );
        return NULL;
    }

    IMAGE::TPixelMapPtr pixelMap;
    if ( !image.TryGetPixelMap( 0, 0, pixelMap ) )
    {
        GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: Unable to get the pixel map from the image" );
        return NULL;
    }
    
    // CEGUI does not support single channel formats
    if ( pixelMap->GetNumberOfChannelsPerPixel() < 3 )
    {
        GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: CEGUI cannot handle images with less than 3 channels per pixels" );
        return NULL;        
    }
    
    // CEGUI only supports a subset of formats, convert as needed
    IMAGE::TPixelStorageFormat sourceFormat = pixelMap->GetPixelStorageFormat();
    switch ( sourceFormat )
    {
        case IMAGE::PSF_BGR:
        {
            IMAGE::TPixelMapPtr newPixelMap;
            if ( !pixelMap->ConvertFormatTo( IMAGE::PSF_RGB, MT::DATATYPE_UINT8, newPixelMap ) )
            {
                GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: CEGUI cannot handle BGR images and we were unable to convert" );
                return NULL;
            }
            if ( newPixelMap )
            {
                GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: CEGUI cannot handle BGR images, we successfully converted the image" );
                pixelMap = newPixelMap;
            }
            break;
        } 
        case IMAGE::PSF_BGRA:
        {
            IMAGE::TPixelMapPtr newPixelMap;
            if ( !pixelMap->ConvertFormatTo( IMAGE::PSF_RGBA, MT::DATATYPE_UINT8, newPixelMap ) )
            {
                GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: CEGUI cannot handle BGRA images and we were unable to convert" );
                return NULL;
            }
            if ( newPixelMap )
            {
                GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: CEGUI cannot handle BGRA images, we sucecssfully converted the image" );
                pixelMap = newPixelMap;
            }
            break;
        } 
    }

    // CEGUI only supports a subset of channel sizes, convert as needed
    // If we get here then the pixels are stored in a supported format either due to conversion or they were already
    // However the channelsize can still be wrong in the latter case
    CORE::UInt32 channelSize = pixelMap->GetPixelChannelSize();
    if ( channelSize > 1 )
    {
        IMAGE::TPixelStorageFormat sourceFormat = pixelMap->GetPixelStorageFormat();
        IMAGE::TPixelMapPtr newPixelMap;
        if ( !pixelMap->ConvertFormatTo( sourceFormat, MT::DATATYPE_UINT8, newPixelMap ) )
        {
            GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: CEGUI cannot handle images with multi-byte channels and we were unable to convert" );
            return NULL;
        }
        
        if ( newPixelMap )
        {
            GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: CEGUI cannot handle images with multi-byte channels, we sucecssfully converted the image to single byte" );
            pixelMap = newPixelMap;
        }
        channelSize = pixelMap->GetPixelChannelSize();
    }
    
    // Now that we have the image in a format we know CEGUI can handle,.. convert the type enum
    CEGUI::Texture::PixelFormat ceguiPixelFormat;
    if ( !TryConvertPixelFormat( pixelMap->GetPixelStorageFormat(), channelSize, ceguiPixelFormat ) )
    {
        GUCEF_WARNING_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: Failed to map pixel storage format to a CEGUI supported type" );
        return NULL;        
    }
        
    CEGUI::Sizef imageSizeInPixels( (float) pixelMap->GetWidthInPixels(), (float) pixelMap->GetHeightInPixels() );
    result->loadFromMemory( pixelMap->GetDataPtr(), imageSizeInPixels, ceguiPixelFormat );
    GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "ImageCodecAdapter:load: Successfully loaded image into texture obj" );
    return result;
}
Example #6
0
bool
COgreWindowContext::Initialize( const GUI::CString& title                ,
                                const GUI::CVideoSettings& videoSettings ,
                                const GUI::CString& ogreRenderSystem     )
{GUCEF_TRACE;

    // Do not initialize twice
    Shutdown();

    // First create a regular O/S window
    if ( m_osWindow->WindowCreate( title                                       ,
                                   0                                           ,
                                   0                                           ,
                                   videoSettings.GetResolutionWidthInPixels()  ,
                                   videoSettings.GetResolutionHeightInPixels() ) )
    {
        // Display the new window
        m_osWindow->Show();
        m_osWindow->SendToForegound();
        m_osWindow->GrabFocus();

	    // Now proceed with setting up the Ogre specifics
        
        // We grab the O/S window identifier 'the handle' 
        // This is passed to Ogre to tie things together
        CORE::Int64 windowRef = 0; 
        CORE::CString windowIntStr = m_osWindow->GetProperty( "WINDOWINT" );
        if ( !windowIntStr.IsNULLOrEmpty() )
        {
            windowRef = CORE::StringToInt64( windowIntStr );
        }
        Ogre::NameValuePairList options;         
        options[ "externalWindowHandle" ] = Ogre::StringConverter::toString( (size_t) windowRef ); 

        Ogre::Root* ogreRoot = Ogre::Root::getSingletonPtr();
        if ( ogreRoot == nullptr )
        {            
            ogreRoot = OGRE_NEW Ogre::Root( "", "", "" ); 
        }

        if ( !ogreRoot->isInitialised() )
        {
            // Load any Ogre plugins not loaded yet from the bootstrap group
            CORE::CCoreGlobal::Instance()->GetPluginControl().LoadPluginGroup( "Ogre" );
            
            const Ogre::RenderSystemList& rsList = ogreRoot->getAvailableRenderers();
            if ( rsList.size() == 0 )
            {
                GUCEF_ERROR_LOG( CORE::LOGLEVEL_IMPORTANT, "OgreWindowContext: No Ogre render systems are available, cannot initialize" );
                return false;
            }

            Ogre::RenderSystem* renderSystem = nullptr;
            Ogre::RenderSystemList::const_iterator i = rsList.begin();
            while ( i != rsList.end() )
            {
                GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "OgreWindowContext: Available Ogre render system: " + (*i)->getFriendlyName() );
                if ( ogreRenderSystem == (*i)->getName() )
                {
                    GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "OgreWindowContext: Found desired/preferred Ogre render system: " + (*i)->getFriendlyName() );
                    renderSystem = (*i); 
                }
                ++i;
            }
            if ( renderSystem == nullptr )
            {
                GUCEF_WARNING_LOG( CORE::LOGLEVEL_IMPORTANT, "OgreWindowContext: Preferred Ogre render systems not available, using first available alternative: " + (*rsList.begin())->getFriendlyName() );
                renderSystem = *rsList.begin();
            }

            ogreRoot->setRenderSystem( renderSystem );
            m_sceneManager = ogreRoot->createSceneManager( Ogre::ST_GENERIC );

            m_renderWindow = ogreRoot->initialise( false, title );
        }

        m_renderWindow = ogreRoot->createRenderWindow( title, 
                                                       videoSettings.GetResolutionWidthInPixels(), 
                                                       videoSettings.GetResolutionHeightInPixels(), 
                                                       videoSettings.GetFullscreenState(),
                                                       &options ); 

        // Grab the main app pulse generator and set the update interval for the context to the desired refresh rate
        CORE::CPulseGenerator& pulseGenerator = CORE::CCoreGlobal::Instance()->GetPulseGenerator(); 
        pulseGenerator.RequestPeriodicPulses( this, 1000 / videoSettings.GetFrequency() );
        SubscribeTo( &pulseGenerator );

        GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "OgreWindowContext: Succesfully created Ogre rendering context" );
        m_initialized = true;
        return true;
    }
    return false;
}
bool
CCEGUIDriver::LoadConfig( const CORE::CDataNode& treeroot )
{GUCEF_TRACE;

    const CORE::CDataNode* ceguiConfig = treeroot.Find( "CEGUI" );
    if ( nullptr == ceguiConfig )
    {   
        GUCEF_ERROR_LOG( CORE::LOGLEVEL_IMPORTANT, "CGUIDriver:LoadConfig: Cannot find CEGUI config and as such will not be able to initialize" );
        return false;
    }

    m_schemeToUse = ceguiConfig->GetAttributeValueOrChildValueByName( "Scheme" );
    m_defaultFont = ceguiConfig->GetAttributeValueOrChildValueByName( "DefaultFont" );
    m_defaultCursorImage = ceguiConfig->GetAttributeValueOrChildValueByName( "DefaultCursorImage" );
     
    // the default is the fallback resource group if none is passed to the adapter
    CORE::CString defaultResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "DefaultResourceGroup" );
    if ( defaultResourceGroup.IsNULLOrEmpty() )
        defaultResourceGroup = "CEGUI";
    m_vfsResourceProvider.setDefaultResourceGroup( defaultResourceGroup );

    CORE::CString imageSetsResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "ImageSetsResourceGroup" );
    CORE::CString fontsResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "FontsResourceGroup" );
    CORE::CString schemesResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "SchemesResourceGroup" );
    CORE::CString lookNFeelResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "LookNFeelsResourceGroup" );
    CORE::CString layoutsResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "LayoutsResourceGroup" );
    CORE::CString animationsResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "AnimationsResourceGroup" );
    CORE::CString scriptsResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "ScriptsResourceGroup" );
    m_schemasResourceGroup = ceguiConfig->GetAttributeValueOrChildValueByName( "SchemasResourceGroup" );

    // set the default resource groups to be used
    CEGUI::ImageManager::setImagesetDefaultResourceGroup( imageSetsResourceGroup );
    CEGUI::Font::setDefaultResourceGroup( fontsResourceGroup );
    CEGUI::Scheme::setDefaultResourceGroup( schemesResourceGroup );
    CEGUI::WidgetLookManager::setDefaultResourceGroup( lookNFeelResourceGroup );
    CEGUI::WindowManager::setDefaultResourceGroup( layoutsResourceGroup );
    CEGUI::AnimationManager::setDefaultResourceGroup( animationsResourceGroup );
    CEGUI::ScriptModule::setDefaultResourceGroup( scriptsResourceGroup );

    // setup default group for validation schemas
    CEGUI::System* ceguiSystem = CEGUI::System::getSingletonPtr();
    if ( nullptr != ceguiSystem )
    {
        CEGUI::XMLParser* parser = ceguiSystem->getXMLParser();
        if ( nullptr != parser && parser->isPropertyPresent( "SchemaDefaultResourceGroup" )  )
            parser->setProperty( "SchemaDefaultResourceGroup", m_schemasResourceGroup );
    }

    const CORE::CDataNode* ceguiVfsConfig = treeroot.Search( "CEGUI/VFSAdapter", '/', false );
    if ( nullptr != ceguiVfsConfig )
    {   
        CORE::CDataNode::TConstDataNodeSet grpNodes = ceguiVfsConfig->FindChildrenOfType( "ResourceGroup" );
        CORE::CDataNode::TConstDataNodeSet::iterator i = grpNodes.begin();
        while ( i != grpNodes.end() )
        {
            CORE::CString groupName = (*i)->GetAttributeValueOrChildValueByName( "Name" );
            CORE::CString vfsPath = (*i)->GetAttributeValueOrChildValueByName( "Path" );

            m_vfsResourceProvider.setResourceGroupDirectory( groupName, vfsPath );

            ++i;
        }
    }

    return true;
}
bool
CGUIDriverOgre::Init( GUI::TWindowContextPtr windowContext )
{
    if ( !m_ceGuiInitialized )
    {
        try
        {
            Ogre::RenderTarget* renderTarget = nullptr;
            CORE::CString renderTargetPtrStr = windowContext->GetProperty( "Ogre::RenderTarget" );
            if ( !renderTargetPtrStr.IsNULLOrEmpty() )
            {
                renderTarget = static_cast< Ogre::RenderTarget* >( CORE::StringToPointer( renderTargetPtrStr ) );
                if ( NULL == renderTarget )
                    return false;
            }
            Ogre::SceneManager* sceneManager = nullptr;
            CORE::CString sceneManagerPtrStr = windowContext->GetProperty( "Ogre::SceneManager" );
            if ( !sceneManagerPtrStr.IsNULLOrEmpty() )
            {
                sceneManager = static_cast< Ogre::SceneManager* >( CORE::StringToPointer( sceneManagerPtrStr ) );
                if ( NULL == sceneManager )
                    return false;
            }
            
            // Auto-create a viewport here if none exists yet
            unsigned short viewportCount = renderTarget->getNumViewports();
            if ( 0 == viewportCount )
            {
                Ogre::Camera* camera = sceneManager->createCamera( "CEGUI" );
                camera->setPosition( Ogre::Vector3( 0, 0, 500 ) );
                camera->lookAt( Ogre::Vector3( 0, 0, -300 ) );
                camera->setNearClipDistance( 5 );

                // Create a viewport covering whole window
                Ogre::Viewport* viewport = renderTarget->addViewport( camera );
                viewport->setBackgroundColour( Ogre::ColourValue( 0.0f, 0.0f, 0.0f, 0.0f ) );
                viewport->setOverlaysEnabled( true );
                                                  
                // Update the camera aspect ratio to that of the viewport
                camera->setAspectRatio( Ogre::Real( viewport->getActualWidth() ) / Ogre::Real( viewport->getActualHeight() ) );                
            }

            CEGUI::Sizef displaySize( (float) windowContext->GetWidth(), (float) windowContext->GetHeight() );
            m_guiRenderer = &CEGUI::OgreRenderer::create( *renderTarget );// displaySize );//, CEGUI::OpenGLRenderer::TTT_AUTO );
            m_guiRenderer->setDefaultRootRenderTarget( *renderTarget );
            m_guiSystem = &CEGUI::System::create( *m_guiRenderer, &m_vfsResourceProvider, &m_xmlParserAdapter, m_imageCodecAdapter );

            // setup default group for validation schemas
            CEGUI::XMLParser* parser = m_guiSystem->getXMLParser();
            if ( nullptr != parser && parser->isPropertyPresent( "SchemaDefaultResourceGroup" )  )
                parser->setProperty( "SchemaDefaultResourceGroup", m_schemasResourceGroup );

            // Load the fonts
            CEGUI::FontManager::getSingleton().createAll( m_defaultFont, CEGUI::Font::getDefaultResourceGroup() );
        
            // Load the scheme
            try
            {
                CEGUI::SchemeManager::getSingleton().createFromFile( "Generic.scheme" );
            }
            catch ( CEGUI::Exception& e )
            {
                CORE::CString info = e.getMessage() + " - at - " + e.getFileName() + ":" + e.getFunctionName() + ":" + CORE::UInt32ToString( e.getLine() ).STL_String();
                GUCEF_EXCEPTION_LOG( CORE::LOGLEVEL_IMPORTANT, "Unhandled exception during CEGUI initialization: " + info );
            }
            CEGUI::SchemeManager::getSingleton().createFromFile( m_schemeToUse );
        
            // Set the defaults
            CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultFont( m_defaultFont );
            CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage( m_defaultCursorImage );
            CEGUI::Window* rootWindow = CEGUI::WindowManager::getSingleton().createWindow( "DefaultWindow", "root" );
            CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow( rootWindow );
            
            // clearing this queue actually makes sure it's created(!)
            CEGUI::System::getSingleton().getDefaultGUIContext().clearGeometry( CEGUI::RQ_OVERLAY );                                             
        
            m_ceGuiInitialized = true;
        }
        catch ( CEGUI::Exception& e )
        {
            CORE::CString info = e.getMessage() + " - at - " + e.getFileName() + ":" + e.getFunctionName() + ":" + CORE::UInt32ToString( e.getLine() ).STL_String();
            GUCEF_EXCEPTION_LOG( CORE::LOGLEVEL_IMPORTANT, "Unhandled exception during CEGUI initialization: " + info );

            m_ceGuiInitialized = false;
        }
    }
    return m_ceGuiInitialized;
}