static public Sprite GetSprite(Bitmap _image) { Sprite wall; Bitmap image = _image; wall = new Sprite(image.Width, image.Height); asparagus.Game.Color[] wColors = new asparagus.Game.Color[wall.width * wall.height]; string wChars = ""; for (var i = 0; i < wall.width * wall.height; i++) { wChars += " "; } for (var x = 0; x < wall.width; x++) { for (var y = 0; y < wall.height; y++) { System.Drawing.Color pixelColor = image.GetPixel(x, y); int pixelIndex = Game.Index(x, y, wall.width); wColors[pixelIndex] = GetColor(x, y, image); } } wall.Load(wChars, wColors); return(wall); }
public static Pixel[] GetTitle() { string titleChars = ""; titleChars += " _____ __ __ __ "; titleChars += " |_ _| / / / / / / "; titleChars += " | | / /_ / /_ / /_ "; titleChars += " | | | '_ \\ | '_ \\ | '_ \\ "; titleChars += " _| |_ | (_) | | (_) | | (_) |"; titleChars += " |_____| \\___/ \\___/ \\___/ "; titleChars += " "; asparagus.Game.Color[] titleColors = new asparagus.Game.Color[titleWidth * titleHeight]; for (var i = 0; i < titleColors.Length; i++) { titleColors[i] = new Game.Color(RED, BLACK); } Pixel[] pixels = new Pixel[titleWidth * titleHeight]; for (var i = 0; i < pixels.Length; i++) { Pixel pixel = new Pixel(); pixel.Char.UnicodeChar = titleChars[i]; pixel.Attributes = (short)ColorInt(titleColors[i].foreground, titleColors[i].background); pixels[i] = pixel; } return(pixels); }