예제 #1
0
 SourceFrame BitmapFont::GetSourceFrameForCharacter(char aCharacter)
 {
     CharacterData* characterData = m_CharacterData[aCharacter];
     if(characterData != nullptr)
     {
         return characterData->GetSourceFrame();
     }
     return SourceFrame(0.0f, 0.0f, 0.0f, 0.0f);
 }
예제 #2
0
 void BitmapFont::ParseCharactersNode(xml_node<> *aCharactersNode)
 {
     //Cycle through the characters and add them to the character map
     for (xml_node<> *character = aCharactersNode->first_node(); character; character = character->next_sibling())
     {
         //Create a new character data object
         CharacterData* characterData = new CharacterData();
         
         //Parse the character
         char characterId = characterData->ParseCharacterNode(character, this);
         
         #if LOG_BITMAP_FONT_GLYPH_DATA
         Log("Character Data for Character: %c - width: %f - height: %f - bearingX: %f - bearingY: %f - advance: %u", characterId, characterData->GetSourceFrame().size.x, characterData->GetSourceFrame().size.y, characterData->GetOffset().x, characterData->GetOffset().y, characterData->GetAdvanceX());
         #endif
         
         //Push back the character onto the character set vector
         m_CharacterSet.push_back(characterId);
         
         //Set the character data
         m_CharacterData[characterId] = characterData;
     }
 }