示例#1
0
 public void RectangleDraw(FoxDraw foxDraw, int size, Color colors)
 {
     foxDraw.FillColor(colors);
     foxDraw.DrawRectangle(canvas.Width / 2 - size / 2, canvas.Height / 2 - size / 2, size, size);
 }
 public void DrawMyRectangle(FoxDraw foxDraw, double x, double y, double width, double height, Color color)
 {
     foxDraw.SetFillColor(color);
     foxDraw.DrawRectangle(x, y, width, height);
 }
示例#3
0
 public void RectangleDraw(FoxDraw Line, int p1, int p2)
 {
     Line.DrawRectangle(p1, p2, 50, 50);
 }
示例#4
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);

            var dict = new Dictionary <Color, List <int> >()
            {
                { Colors.Beige, new List <int> ()
                  {
                      150, 100, 250, 100
                  } },
                { Colors.Brown, new List <int>()
                  {
                      250, 100, 250, 200
                  } },
                { Colors.Green, new List <int>()
                  {
                      250, 200, 150, 200
                  } },
                { Colors.Black, new List <int>()
                  {
                      150, 200, 150, 100
                  } },

                { Colors.Violet, new List <int> ()
                  {
                      170, 80, 270, 80
                  } },
                { Colors.Tan, new List <int>()
                  {
                      270, 80, 270, 180
                  } },
                { Colors.CadetBlue, new List <int>()
                  {
                      270, 180, 170, 180
                  } },
                { Colors.DarkGoldenrod, new List <int>()
                  {
                      170, 180, 170, 80
                  } },

                { Colors.RosyBrown, new List <int>()
                  {
                      150, 100, 170, 80
                  } },
                { Colors.Salmon, new List <int>()
                  {
                      250, 100, 270, 80
                  } },
                { Colors.Silver, new List <int>()
                  {
                      250, 200, 270, 180
                  } },
                { Colors.Olive, new List <int>()
                  {
                      150, 200, 170, 180
                  } }
            };

            foreach (var item in dict)
            {
                foxDraw.SetStrokeColor(item.Key);
                foxDraw.DrawLine(item.Value[0], item.Value[1], item.Value[2], item.Value[3]);
            }
        }
 public void DrawSquare(FoxDraw foxDraw, double size, Color color)
 {
     foxDraw.SetFillColor(color);
     foxDraw.DrawRectangle(Width / 2 - size / 2, Height / 2 - size / 2, size, size);
 }
示例#6
0
 public MainWindow()
 {
     InitializeComponent();
     FoxDraw = new FoxDraw(canvas);
     FoxDraw.AddImage("Assets/boss.png", 0, 0);
 }
示例#7
0
        static public List <bool> GenerateRandomRoute(FoxDraw foxDraw, int start, int xmax)
        {
            int x = start % xmax;
            int y = start / xmax;

            foxDraw.AddImage("./assets/floor.gif", x * 50, y * 50);
            count--;

            if (count == 0)
            {
                field[start] = true;
                return(field);
            }
            else
            {
                while (!field[start])
                {
                    Random random = new Random();
                    int    index  = random.Next(0, 4);
                    if (index == 0)
                    {
                        if (x > 0 && !(field[start - 1]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start - 1, xmax));
                            }
                        }
                    }
                    if (index == 1)
                    {
                        if (y > 0 && !(field[start - xmax]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start - xmax, xmax));
                            }
                        }
                    }
                    if (index == 2)
                    {
                        if (x < xmax - 1 && !(field[start + 1]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start + 1, xmax));
                            }
                        }
                    }
                    if (index == 3)
                    {
                        if (y < (field.Count / xmax) - 1 && !(field[start + xmax]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start + xmax, xmax));
                            }
                        }
                    }
                }
                return(field);
            }
        }
 public void SquareX50(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.DrawRectangle(x, y, 50, 50);
 }
 public void ToTheCenter(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.DrawLine(x, y, Width / 2, Height / 2);
 }
 public void Rainbow(FoxDraw foxDraw, int velikost, Color barva)
 {
     foxDraw.SetFillColor(barva);
     foxDraw.DrawRectangle((Width / 2) - (velikost / 2), (Height / 2) - (velikost / 2), velikost, velikost);
 }
 public void CenteredSquare(FoxDraw foxDraw, int x)
 {
     foxDraw.DrawRectangle((Width / 2) - (x / 2), (Height / 2) - (x / 2), x, x);
 }
        public MainWindow()
        {
            InitializeComponent();
    #if DEBUG
            this.AttachDevTools();
    #endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);

            canvas.Width  = 800;
            canvas.Height = 800;
            foxDraw.SetStrokeColor(Colors.Black);
            foxDraw.SetFillColor(Colors.Transparent);

            //LINEINTHEMIDDLE
            //draw a red horizontal line to the canvas' middle.
            //draw a green vertical line to the canvas' middle.

            /*
             * foxDraw.SetBackgroundColor(Colors.LightYellow);
             * foxDraw.SetStrokeColor(Colors.Red);
             * foxDraw.DrawLine(0, canvas.Height / 2, canvas.Width, canvas.Height / 2);
             * foxDraw.SetStrokeColor(Colors.Green);
             * foxDraw.DrawLine(canvas.Width/2, 0, canvas.Width/2, canvas.Height);
             */

            //COLOREDBOX
            // Draw a box that has different colored lines on each edge.

            /*
             * foxDraw.SetStrokeColor(Colors.Red);
             * foxDraw.DrawLine(300, 300, 700, 300);
             * foxDraw.SetStrokeColor(Colors.Blue);
             * foxDraw.DrawLine(700, 300, 700, 700);
             * foxDraw.SetStrokeColor(Colors.Green);
             * foxDraw.DrawLine(700, 700, 300, 700);
             * foxDraw.SetStrokeColor(Colors.Yellow);
             * foxDraw.DrawLine(300, 700, 300, 300);
             */

            //DIAGONALS
            // Draw the canvas' diagonals.
            // If it starts from the upper-left corner it should be green, otherwise it should be red.

            /*
             * foxDraw.SetStrokeColor(Colors.Green);
             * foxDraw.DrawLine(0, 0, canvas.Width, canvas.Height);
             * foxDraw.SetStrokeColor(Colors.Red);
             * foxDraw.DrawLine(canvas.Width, 0, 0, canvas.Height);
             */

            //TO THE CENTER
            // Create a function that draws a single line and takes 3 parameters:
            // The x and y coordinates of the line's starting point and the
            // foxDraw and draws a line from that point to the center of the
            // canvas.
            // Draw at least 3 lines with that function using a loop.

            /*
             * int numberOfLines = 100;
             * do
             * {
             *  ToTheCenter(foxDraw, numberOfLines, 100);
             *  numberOfLines += 200;
             * } while (numberOfLines<800);
             */

            //HORIZONTAL
            // Create a function that draws a single line and takes 3 parameters:
            // The x and y coordinates of the line's starting point and the foxDraw
            // and draws a 50 long horizontal line from that point.
            // Draw at least 3 lines with that function using a loop.

            /*
             * int numberOfLines = 0;
             * int x = 50;
             * int y = 100;
             * do
             * {
             *
             *  HorLine(foxDraw, x, y);
             *  numberOfLines++;
             *  x += 100;
             *  y += 50;
             *
             * } while (numberOfLines < 3);
             */

            // CENTEREDSQUARE
            // Draw a green 10x10 square to the canvas' center.

            /*
             * foxDraw.DrawRectangle(Width / 2, Height / 2, 10, 10);
             */

            //FOURRECTANGLES
            // draw four different size and color rectangles.
            // avoid code duplication.

            /*
             * var x = 20;
             * for (int i = 0; i < 4; i++)
             * {
             *  if (i<1)
             *  {
             *      foxDraw.SetStrokeColor(Colors.DarkRed);
             *      foxDraw.SetFillColor(Colors.DarkRed);
             *  }
             *  else if (i <2)
             *  {
             *      foxDraw.SetStrokeColor(Colors.CornflowerBlue);
             *      foxDraw.SetFillColor(Colors.CornflowerBlue);
             *  }
             *  else if (i < 3)
             *  {
             *      foxDraw.SetStrokeColor(Colors.GreenYellow);
             *      foxDraw.SetFillColor(Colors.GreenYellow);
             *  }
             *  else
             *  {
             *      foxDraw.SetStrokeColor(Colors.Black);
             *      foxDraw.SetFillColor(Colors.Black);
             *  }
             *  foxDraw.DrawRectangle(x, x, x, x);
             *  x += x;
             * }
             */

            //POSITIONSQUARE
            // create a function that draws one square and takes 3 parameters:
            // the x and y coordinates of the square's top left corner
            // and the foxDraw and draws a 50x50 square from that point.
            // draw 3 squares with that function.
            // avoid code duplication.

            /*
             * for (int i = 1; i < 4; i++)
             * {
             *  SquareX50(foxDraw, i * 100, i * 100);
             * }
             */

            //CENTERBOXFUNCTION
            // create a function that draws one square and takes 2 parameters:
            // the square size and the foxDraw
            // and draws a square of that size to the center of the canvas.
            // draw 3 squares with that function.
            // avoid code duplication.

            /*
             * for (int i = 1; i < 4; i++)
             *  {
             *      CenteredSquare(foxDraw, 30 * i);
             *  }
             */

            //RAINBOWBOXFUNCTION
            // Create a square drawing function that takes 3 parameters:
            // The square size, and the fill color, foxDraw
            // and draws a square of that size and color to the center of the canvas.
            // Create a loop that fills the canvas with rainbow colored squares (red, orange, yellow, green, blue, indigo, violet).

            /*
             * List<Color> barvy = new List<Color> { Colors.Red, Colors.Orange, Colors.Yellow,
             *  Colors.Green, Colors.Blue, Colors.Indigo, Colors.Violet };
             * int x = 200;
             * foreach (var barva in barvy)
             * {
             *  Rainbow(foxDraw, x, barva);
             *  x -= 25;
             * }
             */

            //PURPLESTEPS
            // Reproduce this:
            // [https://github.com/green-fox-academy/chama-cs-prg-syllabus/blob/master/workshop/drawing/assets/r3.png]

            /*
             * var x = 20;
             * for (int i = 0; i < 20; i++)
             * {
             *  foxDraw.SetFillColor(Colors.Purple);
             *  foxDraw.DrawRectangle(x, x, 20, 20);
             *  x +=20;
             * }
             */

            //
            //PURPLESTEPS3D
            // Reproduce this:
            // [https://github.com/green-fox-academy/chama-cs-prg-syllabus/blob/master/workshop/drawing/assets/r4.png]


            double x = 30;
            double y = 30;
            for (int i = 0; i < 6; i++)
            {
                foxDraw.SetFillColor(Colors.Purple);
                foxDraw.DrawRectangle(y, y, x, x);
                y += x;
                x += x / 4;
            }
        }
        /// Don't kill me for this code ///
        public static void linePlay4(FoxDraw foxDraw)
        {
            var startPoint = new Point(0, 0);
            var endPoint   = new Point(0, 400);

            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0, 0 + (i * 40), 0 + (i * 40), 400);
                foxDraw.SetStrokeColor(Colors.DarkViolet);
            }
            startPoint = new Point(0, 0);
            endPoint   = new Point(400, 0);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.AntiqueWhite);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0 + (i * 40), 0, 400, 0 + (i * 40));
            }

            startPoint = new Point(400, 0);
            endPoint   = new Point(400, 400);
            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400, 0 + (i * 40), 400 + (i * 40), 400);
                foxDraw.SetStrokeColor(Colors.Blue);
            }
            startPoint = new Point(400, 0);
            endPoint   = new Point(800, 0);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.IndianRed);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400 + (i * 40), 0, 800, 0 + (i * 40));
            }
            startPoint = new Point(0, 400);
            endPoint   = new Point(0, 800);
            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0, 400 + (i * 40), 0 + (i * 40), 800);
                foxDraw.SetStrokeColor(Colors.BurlyWood);
            }
            startPoint = new Point(0, 400);
            endPoint   = new Point(400, 400);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.Aquamarine);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0 + (i * 40), 400, 400, 400 + (i * 40));
            }
            startPoint = new Point(400, 400);
            endPoint   = new Point(400, 800);
            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400, 400 + (i * 40), 400 + (i * 40), 800);
                foxDraw.SetStrokeColor(Colors.Firebrick);
            }
            startPoint = new Point(400, 400);
            endPoint   = new Point(800, 400);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.LawnGreen);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400 + (i * 40), 400, 800, 400 + (i * 40));
            }
        }
示例#14
0
        public void Drawer(FoxDraw foxDraw)
        {
            List <List <Point> > list = new List <List <Point> >();

            for (int i = 0; i < 15; i++)
            {
                List <Point> sublist = new List <Point>();
                switch (i)
                {
                case 0:
                case 14:
                    Point myPoint = new Point(8 * i, 5 * 10);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 12);
                    sublist.Add(myPoint);
                    break;

                case 1:
                case 13:
                    myPoint = new Point(8 * i, 5 * 7);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 9);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 13);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 15);
                    sublist.Add(myPoint);
                    break;

                case 2:
                case 12:
                    myPoint = new Point(8 * i, 5 * 4);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 6);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 10);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 12);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 16);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 18);
                    sublist.Add(myPoint);
                    break;

                default:

                    for (int j = 0; j < 22;)
                    {
                        myPoint = new Point(5 * j, 8 * i);
                        sublist.Add(myPoint);
                        if (j % 3 == 0)
                        {
                            j += 4;
                        }
                        else
                        {
                            j += 2;
                        }
                    }

                    if (i % 2 == 0)
                    {
                        myPoint = new Point(5 * 22, 8 * i);
                        sublist.Add(myPoint);
                    }
                    break;
                }
                list.Add(sublist);
            }

            foxDraw.StrokeColor(Colors.Black);
            for (int i = 0; i < 14; i++)
            {
                for (int j = 0; j < list[i].Count; j += 2)
                {
                    switch (i)
                    {
                    case 0:
                    case 14:
                        i = i + 1 - 1;
                        break;

                    case 1:
                    case 13:
                        i = i + 1 - 1;
                        break;

                    case 2:
                    case 12:
                        i = i + 1 - 1;
                        break;

                    default:
                        if (i % 2 == 0)
                        {
                            if (i > 0)
                            {
                                foxDraw.DrawLine(list[i][j], list[i - 1][j]);
                            }
                            if (i < 11)
                            {
                                foxDraw.DrawLine(list[i][j], list[i + 1][j]);
                            }
                            if (j < list[i].Count - 1)
                            {
                                foxDraw.DrawLine(list[i][j], list[i][j + 1]);
                            }
                        }
                        else
                        {
                            if (j < list[i].Count - 1)
                            {
                                if (i < 0)
                                {
                                    foxDraw.DrawLine(list[i][j + 1], list[i - 1][j]);
                                }
                                if (i < 13)
                                {
                                    foxDraw.DrawLine(list[i][j + 1], list[i + 1][j]);
                                }
                                if (j < list[i].Count - 1)
                                {
                                    foxDraw.DrawLine(list[i][j + 1], list[i][j + 1]);
                                }
                            }
                        }
                        break;
                    }
                }
            }
        }
示例#15
0
 public void DrawHorizontal(FoxDraw foxdraw, double x, double y)
 {
     foxdraw.DrawLine(x, y, x + 50, y);
 }
 public void  HorLine(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.DrawLine(x, y, x + 50, y);
 }
示例#17
0
        private static void LinesToCenter(FoxDraw foxDraw, double x, double y)
        {
            double canvasSize = 400;

            foxDraw.DrawLine(x, y, canvasSize / 2, canvasSize / 2);
        }
示例#18
0
 public Character(FoxDraw foxDraw, Map map)
 {
     Map      = map.Tiles;
     Image    = new Image();
     DrawChar = foxDraw;
 }
示例#19
0
 public static void DrawSquare(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.SetFillColor(Colors.Red);
     foxDraw.DrawRectangle(x, y, 50, 50);
 }
示例#20
0
 public void MasterSquare(FoxDraw foxDraw, double x, Color color)
 {
     foxDraw.SetFillColor(color);
     foxDraw.DrawRectangle(Width / 2 - x / 2, Height / 2 - x / 2, x, x);
 }
示例#21
0
 public Map(FoxDraw foxDraw)
 {
     MapCreation();
     MapDraw(foxDraw);
 }
示例#22
0
 public void FiftyFiftySquare(FoxDraw foxDraw, double x1, double y1)
 {
     foxDraw.DrawRectangle(x1, y1, 50, 50);
 }
示例#23
0
        private void LineDrawing(int x, int y)
        {
            var foxDraw = new FoxDraw(canvas);

            foxDraw.DrawLine(x, y, canvas.Width / 2, canvas.Height / 2);
        }
示例#24
0
 public void DrawHorizontalLine(FoxDraw foxDraw, double x1, double y1)
 {
     foxDraw.SetStrokeColor(Colors.Green);
     foxDraw.DrawLine(x1, y1, x1 + 50, y1);
 }
 public void DrawCenter(FoxDraw foxDraw, double size)
 {
     foxDraw.DrawRectangle(Width / 2 - size / 2, Height / 2 - size / 2, size, size);
 }
示例#26
0
 public Map()
 {
     foxdraw = new FoxDraw(Canvas);
 }
 public void DrawLineToCentre(FoxDraw foxDraw, double x, double y)
 {
     foxDraw.DrawLine(x, y, Width / 2, Height / 2);
 }
 public static void LineDrawFunction(FoxDraw canvas, Point start, Point middle)
 {
     canvas.DrawLine(start, middle);
 }
 static void DrawSquare(FoxDraw foxDraw, int size)
 {
     foxDraw.DrawRectangle(263 - size / 2, 175 - size / 2, size, size);
 }
示例#30
0
        public MainWindow()
        {
            InitializeComponent();


            var a      = new FoxDraw(canvas);
            var astart = new Point(0, Height);
            var aend   = new Point(Width, Height);

            a.StrokeColor(Colors.Black);
            a.FillColor(Colors.Black);
            a.DrawLine(astart, aend);

            var b      = new FoxDraw(canvas);
            var bstart = new Point(Width, Height);
            var bend   = new Point((Width / 2), (Height - Math.Sqrt(270000)));

            b.StrokeColor(Colors.Black);
            b.FillColor(Colors.Black);
            b.DrawLine(bstart, bend);

            var c      = new FoxDraw(canvas);
            var cstart = new Point((Width / 2), (Height - Math.Sqrt(270000)));
            var cend   = new Point(0, Height);

            c.StrokeColor(Colors.Black);
            c.FillColor(Colors.Black);
            c.DrawLine(cstart, cend);

            var pointsOnA = new Point[20];
            var pointsOnB = new Point[20];
            var pointsOnC = new Point[20];
            int index     = 0;

            for (int i = 30; i <= Width; i += 30)
            {
                pointsOnA[index] = new Point(i, Height);

                pointsOnB[index] = new Point(600 - (i / 2), Height - Math.Sqrt((Math.Pow(i, 2) - Math.Pow((i / 2), 2))));

                pointsOnC[index] = new Point(0 + (i / 2), Height - Math.Sqrt((Math.Pow(i, 2) - Math.Pow((i / 2), 2))));
                index++;
            }

            //for (int i = 60; i < 61; i++)
            //{
            //
            //var g = new Point(60, Height);
            //var h = new Point(30, Height - Math.Sqrt((Math.Pow(i,2) - Math.Pow((i/2),2))));
            //var tester = new FoxDraw(canvas);
            //tester.DrawLine(g, h);
            //}

            int testindex = 18;

            for (int i = 0; i < 19; i++)
            {
                var test = new FoxDraw(canvas);
                test.DrawLine(pointsOnA[i], pointsOnC[i]);
                var test2 = new FoxDraw(canvas);
                test2.DrawLine(pointsOnB[i], pointsOnC[i]);
                var test3 = new FoxDraw(canvas);
                test2.DrawLine(pointsOnA[i], pointsOnB[testindex]);
                testindex--;
            }
        }