Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // Testingthe Red to geenShift

            Console.WriteLine("ShiftRedToGreen");
            Console.WriteLine("Result");
            Colour c = new Colour();

            c.SetRed(0x5E);
            c.SetBlue(0x88);
            Console.WriteLine(c.GetRed());
            Console.WriteLine(c.GetGreen());
            Console.WriteLine(c.GetBlue());
            Console.WriteLine(c.GetAlpha());
            Console.WriteLine(c.colour);
            c.ShiftRedToGreen();
            Console.WriteLine(c.GetRed());
            Console.WriteLine(c.GetGreen());
            Console.WriteLine(c.GetBlue());
            Console.WriteLine(c.GetAlpha());
            Console.WriteLine(c.colour);
            Console.WriteLine("Expected");
            uint newC = 0x005E0000;

            Console.WriteLine(newC);
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Colour colour = new Colour(94, 0, 0, 0);

            colour.colour = colour.colour >> 8;
            //Colour colour = new Colour();
            Console.WriteLine(colour.GetRed());
            Console.WriteLine(colour.GetGreen());
            Console.WriteLine(colour.GetBlue());
            Console.WriteLine(colour.GetAlpha());
            Console.WriteLine(colour.colour.ToString());
            Console.ReadKey();
        }
        //displays the r, g, b and a values of the provided color in a neat fashion
        public static void printColour(Colour color, String colorName)
        {
            Console.WriteLine();
            Console.Write("Info for ");
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.Write(colorName);
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write(":\n");
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("RED  : " + color.GetRed());
            Console.WriteLine("GREEN: " + color.GetGreen());
            Console.WriteLine("BLUE : " + color.GetBlue());
            Console.WriteLine("ALPHA: " + color.GetAlpha());
            Form tempForm = new Form();

            tempForm.BackColor = System.Drawing.Color.FromArgb(255, color.GetRed(), color.GetGreen(), color.GetBlue());
            tempForm.SetDesktopBounds(1000, 1000, 1000, 1000);
            tempForm.Show();
            MessageBox.Show("This is your color! (Ignoring alpha values)\nPress OK to close...");
            tempForm.Close();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
        }
        //simple program to illustrate different vector and matrix manipulations. Unrelated to assignment and non required.
        static void Main(string[] args)
        {
            do
            {
                Console.Clear();

                Colour bruh = new Colour();
                bruh.SetRed(94);
                Console.WriteLine(bruh.GetRed());
                Console.WriteLine(bruh.colour);
                byte typeChoice = 0;
                do
                {
                    typeChoice = getTypeChoiceFromUser();
                }while (typeChoice == 0);

                Vector3 vec3A;
                Vector3 vec3B;
                Vector4 vec4A;
                Vector4 vec4B;
                Colour  color;

                if (typeChoice == 1)
                {
                    vec3A = getVector3FFromInput("Vector A");
                    vec3B = getVector3FFromInput("Vector B", 1);
                    Console.WriteLine();

                    printVector(vec3A, "Vector A");
                    printVectorNormalized(vec3A, "Vector A");
                    printVector(vec3B, "Vector B", 1);
                    printVectorNormalized(vec3B, "Vector B", 1);

                    printVectorDotProduct(vec3A, vec3B, "Vector A", "Vector B");
                    printVectorCrossProduct(vec3A, vec3B, "Vector A", "Vector B");
                }
                else if (typeChoice == 2)
                {
                    vec4A = getVector4FFromInput("Vector A");
                    vec4B = getVector4FFromInput("Vector B", 1);
                    Console.WriteLine();

                    printVector(vec4A, "Vector A");
                    printVectorNormalized(vec4A, "Vector A");
                    printVector(vec4B, "Vector B", 1);
                    printVectorNormalized(vec4B, "Vector B", 1);

                    printVectorDotProduct(vec4A, vec4B, "Vector A", "Vector B");
                    printVectorCrossProduct(vec4A, vec4B, "Vector A", "Vector B");
                }
                else
                {
                    color = getColourFromInput("Colour");
                    printColour(color, "Colour");
                    Console.WriteLine();
                }

                Console.WriteLine();
                pausePrompt();
            }while (true);
        }