Esempio n. 1
0
        public static void Launch(Turtle turtle)
        {
            BinaryFormatter bf = new BinaryFormatter();

            using (FileStream fs = File.OpenWrite("data.tgc"))
            {
                bf.Serialize(fs, turtle.Data);
            }

            ProcessStartInfo info = new ProcessStartInfo("TurtleGraphics.exe", (turtle.FullScreen ? "-f " : "") + "data.tgc");

            using (Process p = new Process()
            {
                StartInfo = info
            })
            {
                p.EnableRaisingEvents = true;
                p.Start();
            }
        }
Esempio n. 2
0
        void DrawSection(Turtle t, int p)
        {
            for (int i = 0; i < 10; i++)
            {
                t.Forward(2);

                t.SetColor(90 + i * 15, 170, 200);
            }
            t.StoreTurtlePosition();
            t.Rotate(-45);
            for (int i = 0; i < p; i++)
            {
                t.Forward(1);
                t.SetColor(i + 100, 0, 0);
            }
            t.SetColor(90, 170, 200);
            t.RestoreTurtlePosition();
            t.Rotate(45);
            t.Forward(p);
            t.RestoreTurtlePosition(true);
        }
Esempio n. 3
0
        /// <summary>
        /// This is the place to put your turtle code
        /// </summary>
        public Turtle ToExecute()
        {
            Turtle t = new Turtle();

            t.Rotate(-90);

            for (int i = 0; i < 6; i++)
            {
                t.StoreTurtlePosition();


                for (int j = 0; i < 20; i++)
                {
                    DrawSection(t, 100);
                }


                t.RestoreTurtlePosition();
                t.Rotate(-90);
            }
            return(t);
        }
Esempio n. 4
0
        /// <summary>
        /// This is the place to put your turtle code
        /// </summary>
        public Turtle ToExecute()
        {
            Turtle t = new Turtle(true);

            t.BackgroundColor = "Black";
            t.Rotate(-90);
            t.TurtleSpeed = 15;
            for (int i = 0; i < 6; i++)
            {
                t.StoreTurtlePosition();

                for (int j = 0; j < 20; j++)
                {
                    DrawSection(t, 100 - 5 * j);
                }

                t.RestoreTurtlePosition();
                t.Rotate(60);
                t.CaptureScreenshot();
            }
            return(t);
        }
Esempio n. 5
0
        public Turtle ToExecute()
        {
            Turtle     t   = new Turtle(true);
            Text       txt = new Text();
            ImagePrint prn = new ImagePrint();

            t.SetBrushSize(1);
            t.AnimatePath = false;
            t.TurtleSpeed = 50;
            t             = prn.Print(t, "image.bmp");
            t.SetColor("brown");
            t = txt.Write(t, "Želva", true, 1);
            t.Rotate(22.5);
            t.SetColor("Black");
            t = txt.Write(t, "píše!", false, 1);
            for (int i = 0; i < 14; i++)
            {
                t.Rotate(22.5);
                t = txt.Write(t, i + string.Empty, (i % 2) == 1, 1, new Font(SystemFonts.DefaultFont.FontFamily, 36, FontStyle.Underline));
            }

            return(t);
        }