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); }
public static void DrawRect(Point p, float size, Color color) { if (Disabled) { return; } float margin = (1.0f - size) / 2; float x = p.X + margin; float y = p.Y + margin; var screenOffset = new Vec2Float(0, 0); var command = new DebugCommand.Add { Data = new DebugData.Primitives(new[] { new ColoredVertex(new Vec2Float(x, y), screenOffset, color), new ColoredVertex(new Vec2Float(x + size, y), screenOffset, color), new ColoredVertex(new Vec2Float(x + size, y + size), screenOffset, color), new ColoredVertex(new Vec2Float(x, y), screenOffset, color), new ColoredVertex(new Vec2Float(x, y + size), screenOffset, color), new ColoredVertex(new Vec2Float(x + size, y + size), screenOffset, color), }, PrimitiveType.Triangles) }; Commands.Add(command); }
public Line(Vec2Float p1, Vec2Float p2, float width, ColorFloat color) { P1 = p1; P2 = p2; Width = width; Color = color; }
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)); }
public static Vec2Float ReadFrom(System.IO.BinaryReader reader) { var result = new Vec2Float(); result.X = reader.ReadSingle(); result.Y = reader.ReadSingle(); return(result); }
public static ColoredVertex ReadFrom(System.IO.BinaryReader reader) { var result = new ColoredVertex(); result.Position = Vec2Float.ReadFrom(reader); result.Color = ColorFloat.ReadFrom(reader); return(result); }
public PlacedText(string text, Vec2Float pos, TextAlignment alignment, float size, ColorFloat color) { Text = text; Pos = pos; Alignment = alignment; Size = size; Color = color; }
public static Vec2Float ReadFrom(System.IO.BinaryReader reader) { float x = reader.ReadSingle(); float y = reader.ReadSingle(); var result = new Vec2Float(x, y); return(result); }
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))); }
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); }
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); }
public static Camera ReadFrom(System.IO.BinaryReader reader) { Vec2Float center = Model.Vec2Float.ReadFrom(reader); float rotation = reader.ReadSingle(); float attack = reader.ReadSingle(); float distance = reader.ReadSingle(); bool perspective = reader.ReadBoolean(); var result = new Camera(center, rotation, attack, distance, perspective); return(result); }
public static ColoredVertex ReadFrom(System.IO.BinaryReader reader) { Model.Vec2Float?worldPos = null; if (reader.ReadBoolean()) { worldPos = Model.Vec2Float.ReadFrom(reader); } Vec2Float screenOffset = Model.Vec2Float.ReadFrom(reader); Color color = Model.Color.ReadFrom(reader); var result = new ColoredVertex(worldPos, screenOffset, color); return(result); }
public static DebugState ReadFrom(System.IO.BinaryReader reader) { Vec2Int windowSize = Model.Vec2Int.ReadFrom(reader); Vec2Float mousePosWindow = Model.Vec2Float.ReadFrom(reader); Vec2Float mousePosWorld = Model.Vec2Float.ReadFrom(reader); string[] pressedKeys = new string[reader.ReadInt32()]; for (int i = 0; i < pressedKeys.Length; i++) { pressedKeys[i] = System.Text.Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadInt32())); } Camera camera = Model.Camera.ReadFrom(reader); int playerIndex = reader.ReadInt32(); var result = new DebugState(windowSize, mousePosWindow, mousePosWorld, pressedKeys, camera, playerIndex); return(result); }
public static ColoredVertex ReadFrom(System.IO.BinaryReader reader) { return(new ColoredVertex(Vec2Float.ReadFrom(reader), ColorFloat.ReadFrom(reader))); }
public ColoredVertex(Vec2Float position, ColorFloat color) { Position = position; Color = color; }
public static Vec2Double AsDouble(this Vec2Float a) { return(new Vec2Double((double)a.X, (double)a.Y)); }
public Rect(Vec2Float pos, Vec2Float size, ColorFloat color) { Pos = pos; Size = size; Color = color; }
public static new Rect ReadFrom(System.IO.BinaryReader reader) { return(new Rect(Vec2Float.ReadFrom(reader), Vec2Float.ReadFrom(reader), ColorFloat.ReadFrom(reader))); }
public static Vec2Double ToVec2Double(this Vec2Float vec2f) { return(new Vec2Double(vec2f.X, vec2f.Y)); }