public static void Populate(this PInfo[,] info, PInfo data = null) { if (data == null) { data = new PInfo() { HasBackground = false, HasCharacter = false, HasForeground = false }; } for (int x = 0; x < info.GetLength(0); x++) { for (int y = 0; y < info.GetLength(1); y++) { info[x, y] = new PInfo() { Background = data.Background, HasBackground = data.HasBackground, Character = data.Character, HasCharacter = data.HasCharacter, Foreground = data.Foreground, HasForeground = data.HasForeground }; } } }
public override bool Equals(object obj) { if (obj is PInfo) { PInfo t = obj as PInfo; if (t.HasBackground == HasBackground) { if (t.HasBackground == true && t.Background != Background) { return(false); } } if (t.HasForeground == HasForeground) { if (t.HasForeground == true && t.Foreground != Foreground) { return(false); } } if (t.HasCharacter == HasCharacter) { if (t.HasCharacter == true && t.Character != Character) { return(false); } } return(true); } return(false); }
public PInfo Copy() { PInfo n = new PInfo(); n.Override(this); return(n); }
protected override void PrintPixel(int y, int x) { PInfo pi = ScreenBuffer[x, y]; Brush b = PInfoUtil.GetPInfoBrush(pi); g.FillRectangle(b, new Rectangle(x * PixelSize, y * PixelSize, PixelSize, PixelSize)); }
public static Brush GetPInfoBrush(PInfo pi) { switch (pi.Background) { case ConsoleColor.Black: return(Brushes.Black); case ConsoleColor.DarkBlue: return(Brushes.DarkBlue); case ConsoleColor.DarkGreen: return(Brushes.DarkGreen); case ConsoleColor.DarkCyan: return(Brushes.DarkCyan); case ConsoleColor.DarkRed: return(Brushes.DarkRed); case ConsoleColor.DarkMagenta: return(Brushes.DarkMagenta); case ConsoleColor.DarkYellow: return(Brushes.Yellow); case ConsoleColor.Gray: return(Brushes.Gray); case ConsoleColor.DarkGray: return(Brushes.DarkGray); case ConsoleColor.Blue: return(Brushes.Blue); case ConsoleColor.Green: return(Brushes.Green); case ConsoleColor.Cyan: return(Brushes.Cyan); case ConsoleColor.Red: return(Brushes.Red); case ConsoleColor.Magenta: return(Brushes.Magenta); case ConsoleColor.Yellow: return(Brushes.LightYellow); case ConsoleColor.White: return(Brushes.White); default: return(Brushes.White); } }
/// <summary> /// adds the value of an other <see cref="PInfo"/> to this /// </summary> public void Override(PInfo info) { if (this.HasBackground) { if (info.HasBackground) { this.Background = info.Background; } } else { this.HasBackground = info.HasBackground; this.Background = info.Background; } if (this.HasForeground) { if (info.HasForeground) { this.Foreground = info.Foreground; } } else { this.HasForeground = info.HasForeground; this.Foreground = info.Foreground; } if (this.HasCharacter) { if (info.HasCharacter) { this.Character = info.Character; } } else { this.HasCharacter = info.HasCharacter; this.Character = info.Character; } }