public Pos2 this[int index] { get { switch (index) { case 0: return(topLeft); case 1: return(topRight); case 2: return(bottomLeft); case 3: return(bottomRight); default: throw new IndexOutOfRangeException(); } } set { switch (index) { case 0: topLeft = value; break; case 1: topRight = value; break; case 2: bottomLeft = value; break; case 3: bottomRight = value; break; default: throw new IndexOutOfRangeException(); } } }
internal void MoveBy(Pos2 amount) { for (int i = 0; i <= 3; i++) { this[i] += amount; } }
internal Rect(Pos2 pos1, Pos2 pos2) { if (pos2.X < pos1.X || pos2.Y < pos1.Y) { Pos2 temp = pos1; pos1 = pos2; pos2 = temp; } topLeft = pos1; bottomRight = pos2; topRight = new Pos2(pos2.X, pos1.Y); bottomLeft = new Pos2(pos1.X, pos2.Y); }
internal Textel At(Position.Pos2 p) { return(At(p.X, p.Y)); }