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; string timeNow = DateTime.Now.ToString("HH:mm"); Random random = new Random(); string hours = string.Join("", timeNow[0], timeNow[1]); // int hour = int.Parse(hours); // getting current time into integer int hour = 23; // sets time manually if (hour > 7 && hour < 20) { foxDraw.SetBackgroundColor(Colors.LightBlue); if (hour <= 13) { DrawSun(foxDraw, 100 + ((hour - 7) * 50), 500 - ((hour - 7) * 50)); } else { DrawSun(foxDraw, 100 + ((hour - 7) * 50), 100 + ((hour - 13) * 50)); } } else { foxDraw.SetBackgroundColor(Colors.Black); for (int i = 0; i < random.Next(100, 200); i++) { foxDraw.SetStrokeColor(Colors.Yellow); foxDraw.DrawRectangle(random.Next(0, 800), random.Next(0, 800), 3, 3); } foxDraw.SetStrokeColor(Colors.Transparent); if (hour >= 20 && hour <= 23) { DrawMoon(foxDraw, 100 + ((hour - 19) * 50), 500 - ((hour - 19) * 50)); } else if (hour < 2) { DrawMoon(foxDraw, 100 + ((hour + 5) * 50), 500 - ((hour + 5) * 50)); } else { DrawMoon(foxDraw, 100 + ((hour + 5) * 50), 100 + ((hour - 1) * 50)); } } if (true) { } }
public MainWindow() { InitializeComponent(); // začátek nevim? #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); //vytvoření canvasu var foxDraw = new FoxDraw(canvas); //vytvoření canvasu double canvasWidth = canvas.Width = 600; //zadefinování canvasu, protože to je jinak nekonečno double canvasHeight = canvas.Height = 600; //zadefinování canvasu, protože to je jinak nekonečno //foxDraw.SetBackgroundColor(Colors.Black); /*----------------------------------------------------------------------------------------------------------*/ // Draw the night sky: // - The background should be black // - The stars can be small squares // - The stars should have random positions on the canvas // - The stars should have random color (some shade of grey) List <Color> barvy = new List <Color> { Colors.Blue, Colors.Cyan, Colors.DarkBlue, Colors.Yellow, Colors.Orange }; foxDraw.SetBackgroundColor(Colors.Black); for (int i = 0; i < RandomNumber(20, 100); i++) { foxDraw.SetFillColor(barvy[RandomNumber(0, 4)]); foxDraw.DrawRectangle(RandomNumber(0, 600), RandomNumber(0, 600), 5, 5); // vytvoření random hvězdy 5x5 } }
public MainWindow() { InitializeComponent(); // začátek nevim? #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); //vytvoření canvasu var foxDraw = new FoxDraw(canvas); //vytvoření canvasu double canvasWidth = canvas.Width = 600; //zadefinování canvasu, protože to je jinak nekonečno double canvasHeight = canvas.Height = 600; //zadefinování canvasu, protože to je jinak nekonečno foxDraw.SetBackgroundColor(Colors.Black); /*----------------------------------------------------------------------------------------------------------*/ // 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 = 0; i < 3; i++) { ctverec(foxDraw, 50, 100 * i); } }
public MainWindow() { InitializeComponent(); // začátek nevim? #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); //vytvoření canvasu var foxDraw = new FoxDraw(canvas); //vytvoření canvasu double canvasWidth = canvas.Width = 600; //zadefinování canvasu, protože to je jinak nekonečno double canvasHeight = canvas.Height = 600; //zadefinování canvasu, protože to je jinak nekonečno foxDraw.SetBackgroundColor(Colors.Black); /*----------------------------------------------------------------------------------------------------------*/ // draw four different size and color rectangles. // avoid code duplication. List <Color> barvy = new List <Color>() { Colors.Red, Colors.Blue, Colors.Green, Colors.Yellow }; int i = 1; foreach (var barva in barvy) { foxDraw.SetFillColor(barva); foxDraw.DrawRectangle(50, 50 * i, 10 * i, 5 * i); ++i; } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.Black); double canvasHeight = canvas.Height = 600; double canvasWidth = canvas.Width = 600; // Draw a box that has different colored lines on each edge. int x = 100; int y = 100; foxDraw.SetStrokeColor(Colors.Blue); foxDraw.DrawLine(x, y, 300, 100); foxDraw.SetStrokeColor(Colors.Red); foxDraw.DrawLine(x, y, 100, 300); foxDraw.SetStrokeColor(Colors.White); foxDraw.DrawLine(300, 100, 300, 300); foxDraw.SetStrokeColor(Colors.Green); foxDraw.DrawLine(300, 300, 100, 300); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.Wheat); var colors = new List <Color> { Colors.Red, Colors.Blue, Colors.Yellow, Colors.Pink, Colors.Black }; var colorindex = 0; for (int i = 10; i < 180; i += 30) { foxDraw.SetFillColor(colors[colorindex]); foxDraw.DrawRectangle(i, 0, 20, 20); colorindex++; if (colorindex == colors.Count) { colorindex = 0; } } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif canvas = this.Get<Canvas>("canvas"); foxDraw = new FoxDraw(canvas); DispatcherTimer gameClock = new DispatcherTimer(); gameClock.Interval = new System.TimeSpan(0, 0, 0, 0, 500); gameClock.Tick += delegate { }; gameClock.Start(); foxDraw.SetBackgroundColor(Colors.Black); myFox.Source = new Bitmap("image.png"); foxDraw.AddImage(myFox, 0, 0); foxDraw.SetStrokeColor(Colors.White); foxDraw.DrawLine(100, 100, 400, 400); }
public MainWindow() { InitializeComponent(); // začátek nevim? #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); //vytvoření canvasu var foxDraw = new FoxDraw(canvas); //vytvoření canvasu double canvasWidth = canvas.Width = 600; //zadefinování canvasu, protože to je jinak nekonečno double canvasHeight = canvas.Height = 600; //zadefinování canvasu, protože to je jinak nekonečno //foxDraw.SetBackgroundColor(Colors.Black); foxDraw.SetBackgroundColor(Colors.Black); /*----------------------------------------------------------------------------------------------------------*/ //Line play int a = 0; for (int i = 0; i < 15; i++) { foxDraw.SetStrokeColor(Colors.Purple); foxDraw.DrawLine(300, a, 300 + a, 300); a += 20; foxDraw.SetStrokeColor(Colors.Cyan); foxDraw.DrawLine(300, a, 300 - a, 300); foxDraw.SetStrokeColor(Colors.Cyan); foxDraw.DrawLine(300, a, 300 - a, 300); //foxDraw.SetStrokeColor(Colors.LawnGreen); //foxDraw.DrawLine(0, i, i, Width); } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); canvas.Width = 400; canvas.Height = 400; foxDraw.SetBackgroundColor(Colors.Wheat); foxDraw.SetStrokeColor(Colors.Red); foxDraw.DrawLine(0, 0, canvas.Width, 0); foxDraw.SetStrokeColor(Colors.Green); foxDraw.DrawLine(canvas.Width, 0, canvas.Height, canvas.Height); foxDraw.SetStrokeColor(Colors.Blue); foxDraw.DrawLine(0, canvas.Height, canvas.Height, canvas.Height); foxDraw.SetStrokeColor(Colors.Black); foxDraw.DrawLine(0, 0, 0, canvas.Height); }
public MainWindow() { InitializeComponent(); // začátek nevim? #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); //vytvoření canvasu var foxDraw = new FoxDraw(canvas); //vytvoření canvasu double canvasWidth = canvas.Width = 600; //zadefinování canvasu, protože to je jinak nekonečno double canvasHeight = canvas.Height = 600; //zadefinování canvasu, protože to je jinak nekonečno foxDraw.SetBackgroundColor(Colors.Black); /*----------------------------------------------------------------------------------------------------------*/ // 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. for (int i = 1; i <= 3; i++) { GoToCenter(foxDraw, 100 * i, 50 * i); // násobení pro změnu začátečních hodnot } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.Black); Sierpinski(foxDraw); #endif }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.RosyBrown); foxDraw.SetStrokeColor(Colors.DarkRed); Squares(foxDraw, new Point(0, 0), 800); #endif }
public Stars(FoxDraw foxDraw) { foxDraw.SetBackgroundColor(Colors.Black); Random random = new Random(); for (int i = 0; i < stars.Length; i++) { int ran1 = random.Next(0, 800); int ran2 = random.Next(0, 800); stars[i] = new Star(ran1, ran2, foxDraw); } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); // Draw the night sky: // - The background should be black // - The stars can be small squares // - The stars should have random positions on the canvas // - The stars should have random color (some shade of grey) foxDraw.SetBackgroundColor(Colors.Black); double canvasSize = 400; double rectangleSize = 10; Random random = new Random(); /*int x; * double number = 10; * * x = (int)number;*/ List <Color> colorList = new List <Color> { Colors.LightGray, Colors.Gray, Colors.DimGray, Colors.SlateGray, Colors.DarkSlateGray }; /*random.Next((int)rectangleSize, (int)canvasSize - (int)rectangleSize);*/ double startingPointStarX = (double)(random.Next((int)rectangleSize, (int)canvasSize - (int)rectangleSize)); double startingPointStarY = (double)(random.Next((int)rectangleSize, (int)canvasSize - (int)rectangleSize)); /*random.Next(colorList(Colors[0]), colorList(Colors[4]));*/ for (int i = 0, j = 0; i < 100; i++, j++) { if (j == 4) { j = 0; } foxDraw.SetFillColor(colorList[j]); foxDraw.DrawRectangle(startingPointStarX, startingPointStarY, rectangleSize, rectangleSize); startingPointStarX = (double)(random.Next((int)rectangleSize, (int)canvasSize - (int)rectangleSize)); startingPointStarY = (double)(random.Next((int)rectangleSize, (int)canvasSize - (int)rectangleSize)); } }
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.SetBackgroundColor(Colors.LightBlue); foxDraw.SetStrokeColor(Colors.Black); foxDraw.SetStrokeThicknes(1); UpShape(foxDraw, (Width / 2), (Height / 2) - 140); //first line for (int w = -30; w <= 30; w = w + 60) // second line { UpShape(foxDraw, (Width / 2) + w, (Height / 2) - 120); } for (int w = -60; w <= 60; w = w + 60) // third line copied multiple times { for (int h = -60; h <= 100; h = h + 40) { UpShape(foxDraw, (Width / 2) + w, (Height / 2) - h); } } for (int h = -80; h < 80; h = h + 40) //middle part { for (int w = -90; w <= 90; w = w + 60) { UpShape(foxDraw, (Width / 2) + w, (Height / 2) + h); DownShape(foxDraw, (Width / 2) + w, ((Height / 2) + h) + 40); } } for (int w = -60; w <= 60; w = w + 60) // third to last { DownShape(foxDraw, (Width / 2) + w, (Height / 2) + 100); } for (int w = -30; w <= 30; w = w + 60) // second to last { DownShape(foxDraw, (Width / 2) + w, (Height / 2) + 120); } DownShape(foxDraw, (Width / 2), (Height / 2) + 140); //last line }
public void StarryNight(FoxDraw foxDraw, int maxPocetHvezd) { List <Color> barvy = new List <Color> { Colors.Blue, Colors.Cyan, Colors.DarkBlue, Colors.Yellow, Colors.Orange }; // definice barev foxDraw.SetBackgroundColor(Colors.Black); for (int i = 0; i < RandomNumber(20, maxPocetHvezd); i++) // 20 je min pocet hvezd { foxDraw.SetFillColor(barvy[RandomNumber(0, 4)]); foxDraw.DrawRectangle(RandomNumber(0, 600), RandomNumber(0, 600), 5, 5); // vytvoření random hvězdy 5x5 } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.Black); /*linePlay(foxDraw);*/ /*linePlay4(foxDraw);*/ linePlay16(foxDraw); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); canvas.Width = 300; canvas.Height = 400; foxDraw.SetBackgroundColor(Colors.Wheat); DrawDiagonal(foxDraw, 0, 0, canvas.Width, canvas.Height); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.Wheat); foxDraw.SetFillColor(Colors.Green); foxDraw.SetStrokeColor(Colors.Transparent); foxDraw.DrawRectangle(Width / 2 - 5, Height / 2 - 5, 10, 10); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); canvas.Width = 800; canvas.Height = 600; //here //foxDraw.DrawLine(50, 50, 100, 100); // Draw the night sky: // - The background should be black // - The stars can be small squares // - The stars should have random positions on the canvas // - The stars should have random color (some shade of grey) foxDraw.SetBackgroundColor(Colors.Black); int randomX = 0; int randomY = 0; int randomColorIndex = 0; int starSize = 5; var listOfGreyColors = new List <Color>() { Colors.DarkGray, Colors.DarkSlateGray, Colors.DimGray, Colors.Gray, Colors.LightGray, Colors.LightSlateGray, Colors.SlateGray }; var random = new Random(); for (int i = 0; i < 2000; i++) { randomX = random.Next(Convert.ToInt32(Width) - starSize); randomY = random.Next(Convert.ToInt32(Height) - starSize); randomColorIndex = random.Next(listOfGreyColors.Count - 1); foxDraw.SetFillColor(listOfGreyColors[randomColorIndex]); foxDraw.DrawRectangle(randomX, randomY, starSize, starSize); } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.Wheat); for (int i = 0; i < 100; i += 20) { DrawCenteredLine(foxDraw, i, 0); } }
private void DrawLines(FoxDraw foxDraw) { foxDraw.SetBackgroundColor(Colors.Linen); // draw a red horizontal line to the canvas' middle. var startingPointHorizontal = new Point(0, 400); var endingPointHorizontal = new Point(800, 400); foxDraw.SetStrokeColor(Colors.Red); foxDraw.DrawLine(startingPointHorizontal, endingPointHorizontal); // draw a green vertical line to the canvas' middle. var startingPointVertical = new Point(400, 0); var endingPointVertical = new Point(400, 800); foxDraw.SetStrokeColor(Colors.ForestGreen); foxDraw.DrawLine(startingPointVertical, endingPointVertical); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); // Draw a green 10x10 square to the canvas' center. canvas.Width = 100; canvas.Height = 100; foxDraw.SetBackgroundColor(Colors.Yellow); DrawLine(foxDraw); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); // Envelope star // https://github.com/green-fox-academy/chama-retros-syllabus/blob/master/project/drawing/r2.png canvas.Width = 300; canvas.Height = 300; foxDraw.SetBackgroundColor(Colors.WhiteSmoke); Line(foxDraw, 150); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); // Draw the canvas' diagonals. // If it starts from the upper-left corner it should be green, otherwise it should be red. canvas.Width = 500; canvas.Height = 500; foxDraw.SetBackgroundColor(Colors.Yellow); DrawLine(foxDraw); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); // draw a red horizontal line to the canvas' middle. // draw a green vertical line to the canvas' middle. canvas.Width = 400; canvas.Height = 400; foxDraw.SetBackgroundColor(Colors.Yellow); DrawLine(foxDraw); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); double canvasHeight = canvas.Height = 600; double canvasWidth = canvas.Width = 600; foxDraw.SetBackgroundColor(Colors.Black); foxDraw.SetStrokeColor(Colors.Pink); Lines(foxDraw); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); int starnum = 100; foxDraw.SetBackgroundColor(Colors.Black); for (int i = 0; i < starnum; i++) { CreateSquare(starnum, GetRandomNumber(0, 800), GetRandomNumber(0, 800), foxDraw); } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); canvas.Height = 500; //outputs double canvas.Width = 500; //outputs double // Draw the night sky: // - The background should be black // - The stars can be small squares // - The stars should have random positions on the canvas // - The stars should have random color (some shade of grey) Random randomNumber = new Random(); //set sky foxDraw.SetBackgroundColor(Colors.Black); //generate random number of loops int loops = randomNumber.Next(100, 200); for (int i = 0; i < loops; i++) { //generate random star positions int originX = randomNumber.Next(0, 500); int originY = randomNumber.Next(0, 500); //generate random star sizes int size = randomNumber.Next(1, 5); //array of all grays Color[] grays = { Colors.Gray, Colors.DarkGray, Colors.DarkSlateGray, Colors.DimGray, Colors.LightGray, Colors.LightSlateGray, Colors.SlateGray }; //Choose a random gray Color shadeOfGray = grays[randomNumber.Next(0, grays.Length)]; foxDraw.SetFillColor(shadeOfGray); foxDraw.DrawRectangle(originX, originY, size, size); } }
public MainWindow() { InitializeComponent(); // začátek nevim? #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); //vytvoření canvasu var foxDraw = new FoxDraw(canvas); //vytvoření canvasu double canvasWidth = canvas.Width = 600; //zadefinování canvasu, protože to je jinak nekonečno double canvasHeight = canvas.Height = 600; //zadefinování canvasu, protože to je jinak nekonečno foxDraw.SetBackgroundColor(Colors.Black); /*----------------------------------------------------------------------------------------------------------*/ // Draw a green 10x10 square to the canvas' center. foxDraw.SetStrokeColor(Colors.Green); foxDraw.DrawRectangle(290, 290, 10, 10); }