Beispiel #1
0
        // Access Point For User - Public Methods

        /// <summary>
        /// Runs the turtle, with the specifed commands.
        /// n.b. This should be at the end of any and all drawing you wish to do with this library
        /// </summary>
        public static void Run()
        {
            //Settings;
            Assembly.LoadFinalCommand();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Idle += delegate { Console.WriteLine(Application.MessageLoop); };
            Graph            = new TurtleGraphicsForm();
            Graph.BackingBMP = new Bitmap(Graph.Width, Graph.Height);
            Application.Run(Graph);
        }
Beispiel #2
0
        /// <summary>
        /// Dequeues the Commands in MovementCommandsQueue and Executes them
        /// </summary>
        internal static async void CommandCaller(Graphics GraphicsObj, PictureBox DrawSurface, TurtleGraphicsForm ActiveForm)
        {
            System.Windows.Forms.Timer DrawingWait = new System.Windows.Forms.Timer();
            DrawingWait.Interval = 2000;

            Drawing.CurrentAngle = 0;
            while (MovementCommandsQueue.Count != 0)
            {
                CurrentCommand = MovementCommandsQueue.Dequeue();
                for (ulong RepeatCommand = 1; RepeatCommand <= CurrentCommand.Quantity; RepeatCommand++)
                {
                    ActiveForm.UpdateTurtlePosition();
                    DrawSurface.Invalidate();
                    await Task.Delay(125);

                    CurrentCommand.Command?.Invoke(GraphicsObj);
                }
            }
            DrawSurface.Invalidate();
        }