Пример #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++;
 }
Пример #2
0
 public FontAtlas(int w, int h, int count, Texture2D texture)
 {
     Width          = w;
     Height         = h;
     Texture        = texture;
     Nodes          = new FontAtlasNode[count];
     Nodes[0].X     = 0;
     Nodes[0].Y     = 0;
     Nodes[0].Width = w;
     NodesNumber++;
 }
Пример #3
0
        public FontAtlas(int w, int h, int count, int index)
        {
            Width          = w;
            Height         = h;
            Nodes          = new FontAtlasNode[count];
            Index          = index;
            count          = 0;
            Nodes[0].X     = 0;
            Nodes[0].Y     = 0;
            Nodes[0].Width = w;
            NodesNumber++;

            _texData   = new byte[w * h];
            _colorData = new Color[w * h];
            Array.Clear(_texData, 0, _texData.Length);

            _dirtyRect[0] = Width;
            _dirtyRect[1] = Height;
            _dirtyRect[2] = 0;
            _dirtyRect[3] = 0;
        }
Пример #4
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++;
        }