Exemplo n.º 1
0
        private void FillGraphic()
        {
            bool ret = font.TryAddCharacters(_content);

            int count = Mathf.Min(_content.Length, (int)text.size);

            text.valid_quad = count;
            var one = new float2(1, 1);

            for (int i = 0; i < count; ++i)
            {
                uint unicode       = _content[i];
                var  character     = font.characterLookupTable[unicode];
                var  glyph         = character.glyph;
                var  glyphmetrices = glyph.metrics;
                var  rect          = glyph.glyphRect;
                text.uv0_rect[i] = new float4(rect.x, rect.y, rect.width, rect.height);
                text.tparams[i]  = new float4(glyphmetrices.width, glyphmetrices.height, glyphmetrices.horizontalBearingX, glyphmetrices.horizontalBearingY);
                text.sizes[i]    = new float2(glyphmetrices.horizontalAdvance, 0);
            }

            HUDManager.Instance.RebuildGraphic(text, HUDBatch.all_dirty);
        }