Exemple #1
0
    //---------------------------------------------------------------------
    void FontManager::parseScript(DataStreamPtr& stream, const String& groupName)
    {
        String line;
        FontPtr pFont;

        while( !stream->eof() )
        {
            line = stream->getLine();
            // Ignore blanks & comments
            if( !line.length() || line.substr( 0, 2 ) == "//" )
            {
                continue;
            }
            else
            {
                if (pFont.isNull())
                {
                    // No current font
                    // So first valid data should be font name
                    if (StringUtil::startsWith(line, "font "))
                    {
                        // chop off the 'particle_system ' needed by new compilers
                        line = line.substr(5);
                    }
                    pFont = create(line, groupName);
                    pFont->_notifyOrigin(stream->getName());
                    // Skip to and over next {
                    stream->skipLine("{");
                }
                else
                {
                    // Already in font
                    if (line == "}")
                    {
                        // Finished 
                        pFont.setNull();
                        // NB font isn't loaded until required
                    }
                    else
                    {
                        parseAttribute(line, pFont);
                    }
                }
            }
        }
    }