Esempio n. 1
0
        public static void Write(int value, byte[] bytes, ref int offset)
        {
            var valueBytes = Little.GetBytes(value);

            Array.Copy(valueBytes, 0, bytes, offset, 4);
            offset += 4;
        }
Esempio n. 2
0
        public static void Write(this Color[] colors, byte[] bytes, ref int offset)
        {
            var lengthBytes = Little.GetBytes(colors.Length);

            Array.Copy(lengthBytes, 0, bytes, offset, 4);
            offset += 4;
            for (var i = 0; i < colors.Length; i++)
            {
                var colorBytes = ColorToBytes(colors[i]);
                Array.Copy(colorBytes, 0, bytes, offset, 4);
                offset += 4;
            }
        }
Esempio n. 3
0
        public static void Write(int[] ints, byte[] bytes, ref int offset)
        {
            var lengthBytes = Little.GetBytes(ints.Length);

            Array.Copy(lengthBytes, 0, bytes, offset, 4);
            offset += 4;
            for (var i = 0; i < ints.Length; i++)
            {
                var intBytes = Little.GetBytes(ints[i]);
                Array.Copy(intBytes, 0, bytes, offset, 4);
                offset += 4;
            }
        }
Esempio n. 4
0
        public static void Write(this Vector2[] vectors, byte[] bytes, ref int offset)
        {
            var lengthBytes = Little.GetBytes(vectors.Length);

            Array.Copy(lengthBytes, 0, bytes, offset, 4);
            offset += 4;
            for (var i = 0; i < vectors.Length; i++)
            {
                var vector = vectors[i];
                var x      = Little.GetBytes(vector.x);
                var y      = Little.GetBytes(vector.y);
                Array.Copy(x, 0, bytes, offset, 4);
                offset += 4;
                Array.Copy(y, 0, bytes, offset, 4);
                offset += 4;
            }
        }