Ejemplo n.º 1
0
 public FontAtlas(int w, int h, int count)
 {
     Width          = w;
     Height         = h;
     Nodes          = new FontAtlasNode[count];
     Nodes[0].X     = 0;
     Nodes[0].Y     = 0;
     Nodes[0].Width = w;
     NodesNumber++;
 }
Ejemplo n.º 2
0
        public void InsertNode(int idx, int x, int y, int w)
        {
            if (NodesNumber + 1 > Nodes.Length)
            {
                var oldNodes  = Nodes;
                var newLength = Nodes.Length == 0 ? 8 : Nodes.Length * 2;
                Nodes = new FontAtlasNode[newLength];
                for (var i = 0; i < oldNodes.Length; ++i)
                {
                    Nodes[i] = oldNodes[i];
                }
            }

            for (var i = NodesNumber; i > idx; i--)
            {
                Nodes[i] = Nodes[i - 1];
            }
            Nodes[idx].X     = x;
            Nodes[idx].Y     = y;
            Nodes[idx].Width = w;
            NodesNumber++;
        }