예제 #1
0
    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);
    }
예제 #2
0
    public static asparagus.Game.Color GetColor(int x, int y, Bitmap image)
    {
        System.Drawing.Color cBLACK       = System.Drawing.Color.FromArgb(255, 0, 0, 0);
        System.Drawing.Color cBLUE        = System.Drawing.Color.FromArgb(255, 0, 0, 255);
        System.Drawing.Color cCYAN        = System.Drawing.Color.FromArgb(255, 0, 255, 255);
        System.Drawing.Color cDARKBLUE    = System.Drawing.Color.FromArgb(255, 0, 0, 100);
        System.Drawing.Color cDARKCYAN    = System.Drawing.Color.FromArgb(255, 0, 100, 100);
        System.Drawing.Color cDARKGRAY    = System.Drawing.Color.FromArgb(255, 100, 100, 100);
        System.Drawing.Color cDARKGREEN   = System.Drawing.Color.FromArgb(255, 0, 100, 0);
        System.Drawing.Color cDARKRED     = System.Drawing.Color.FromArgb(255, 100, 0, 0);
        System.Drawing.Color cDARKYELLOW  = System.Drawing.Color.FromArgb(255, 100, 100, 0);
        System.Drawing.Color cGRAY        = System.Drawing.Color.FromArgb(255, 200, 200, 200);
        System.Drawing.Color cGREEN       = System.Drawing.Color.FromArgb(255, 0, 255, 0);
        System.Drawing.Color cMAGENTA     = System.Drawing.Color.FromArgb(255, 255, 100, 100);
        System.Drawing.Color cRED         = System.Drawing.Color.FromArgb(255, 255, 0, 0);
        System.Drawing.Color cWHITE       = System.Drawing.Color.FromArgb(255, 255, 255, 255);
        System.Drawing.Color cYELLOW      = System.Drawing.Color.FromArgb(255, 255, 255, 0);
        System.Drawing.Color cTRANSPARENT = System.Drawing.Color.FromArgb(255, 100, 10, 40);

        Game.Color color = new Game.Color(Game.BLACK, Game.BLACK);;

        System.Drawing.Color pixelColor = image.GetPixel(x, y);

        if (pixelColor == cBLACK)
        {
            color = new Game.Color(Game.BLACK, Game.BLACK);
        }
        if (pixelColor == cBLUE)
        {
            color = new Game.Color(Game.BLUE, Game.BLUE);
        }
        if (pixelColor == cCYAN)
        {
            color = new Game.Color(Game.CYAN, Game.CYAN);
        }
        if (pixelColor == cDARKBLUE)
        {
            color = new Game.Color(Game.DARKBLUE, Game.DARKBLUE);
        }
        if (pixelColor == cDARKCYAN)
        {
            color = new Game.Color(Game.DARKCYAN, Game.DARKCYAN);
        }
        if (pixelColor == cDARKGRAY)
        {
            color = new Game.Color(Game.DARKGRAY, Game.DARKGRAY);
        }
        if (pixelColor == cDARKGREEN)
        {
            color = new Game.Color(Game.DARKGREEN, Game.DARKGREEN);
        }
        if (pixelColor == cDARKRED)
        {
            color = new Game.Color(Game.DARKRED, Game.DARKRED);
        }
        if (pixelColor == cDARKYELLOW)
        {
            color = new Game.Color(Game.DARKYELLOW, Game.DARKYELLOW);
        }
        if (pixelColor == cGRAY)
        {
            color = new Game.Color(Game.GRAY, Game.GRAY);
        }
        if (pixelColor == cGREEN)
        {
            color = new Game.Color(Game.GREEN, Game.GREEN);
        }
        if (pixelColor == cMAGENTA)
        {
            color = new Game.Color(Game.MAGENTA, Game.MAGENTA);
        }
        if (pixelColor == cRED)
        {
            color = new Game.Color(Game.RED, Game.RED);
        }
        if (pixelColor == cWHITE)
        {
            color = new Game.Color(Game.WHITE, Game.WHITE);
        }
        if (pixelColor == cYELLOW)
        {
            color = new Game.Color(Game.YELLOW, Game.YELLOW);
        }
        if (pixelColor == cTRANSPARENT)
        {
            color = new Game.Color(Game.TRANSPARENT, Game.TRANSPARENT);
        }

        return(color);
    }