Ejemplo n.º 1
0
            public static new PlacedText ReadFrom(System.IO.BinaryReader reader)
            {
                var result = new PlacedText();

                result.Text = System.Text.Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadInt32()));
                result.Pos  = Vec2Float.ReadFrom(reader);
                switch (reader.ReadInt32())
                {
                case 0:
                    result.Alignment = TextAlignment.Left;
                    break;

                case 1:
                    result.Alignment = TextAlignment.Center;
                    break;

                case 2:
                    result.Alignment = TextAlignment.Right;
                    break;

                default:
                    throw new System.Exception("Unexpected discriminant value");
                }
                result.Size  = reader.ReadSingle();
                result.Color = ColorFloat.ReadFrom(reader);
                return(result);
            }
Ejemplo n.º 2
0
        public static new PlacedText ReadFrom(System.IO.BinaryReader reader)
        {
            if (reader == null)
            {
                throw new System.ArgumentNullException(nameof(reader));
            }

            var           text = System.Text.Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadInt32()));
            var           pos  = Vec2Float.ReadFrom(reader);
            TextAlignment alignment;

            switch (reader.ReadInt32())
            {
            case 0:
                alignment = TextAlignment.Left;
                break;

            case 1:
                alignment = TextAlignment.Center;
                break;

            case 2:
                alignment = TextAlignment.Right;
                break;

            default:
                throw new System.Exception("Unexpected discriminant value");
            }

            var size  = reader.ReadSingle();
            var color = ColorFloat.ReadFrom(reader);

            return(new PlacedText(text, pos, alignment, size, color));
        }
Ejemplo n.º 3
0
        public static ColoredVertex ReadFrom(System.IO.BinaryReader reader)
        {
            var result = new ColoredVertex();

            result.Position = Vec2Float.ReadFrom(reader);
            result.Color    = ColorFloat.ReadFrom(reader);
            return(result);
        }
Ejemplo n.º 4
0
            public static new Rect ReadFrom(System.IO.BinaryReader reader)
            {
                var result = new Rect();

                result.Pos   = Vec2Float.ReadFrom(reader);
                result.Size  = Vec2Float.ReadFrom(reader);
                result.Color = ColorFloat.ReadFrom(reader);
                return(result);
            }
Ejemplo n.º 5
0
            public static new Line ReadFrom(System.IO.BinaryReader reader)
            {
                var result = new Line();

                result.P1    = Vec2Float.ReadFrom(reader);
                result.P2    = Vec2Float.ReadFrom(reader);
                result.Width = reader.ReadSingle();
                result.Color = ColorFloat.ReadFrom(reader);
                return(result);
            }
Ejemplo n.º 6
0
 public static new Rect ReadFrom(System.IO.BinaryReader reader)
 {
     return(new Rect(Vec2Float.ReadFrom(reader), Vec2Float.ReadFrom(reader), ColorFloat.ReadFrom(reader)));
 }
Ejemplo n.º 7
0
        public static new Line ReadFrom(System.IO.BinaryReader reader)
        {
            if (reader == null)
            {
                throw new System.ArgumentNullException(nameof(reader));
            }

            return(new Line(Vec2Float.ReadFrom(reader), Vec2Float.ReadFrom(reader), reader.ReadSingle(), ColorFloat.ReadFrom(reader)));
        }
Ejemplo n.º 8
0
 public static ColoredVertex ReadFrom(System.IO.BinaryReader reader)
 {
     return(new ColoredVertex(Vec2Float.ReadFrom(reader), ColorFloat.ReadFrom(reader)));
 }