public void RemoveShapeTest()
        {
            Drawing myDrawing = new Drawing();

            Shape[] s =
            { new Rectangle(Color.Red,               25, 25, 50, 50),
              new Rectangle(Color.Green, 25, 10, 50, 50),
              new Rectangle(Color.Blue,  10, 25, 50, 50) };

            Point2D point = SwinGame.PointAt(26, 26);

            //no shape in list
            Assert.AreEqual(myDrawing.Count, 0);
            //can't be selected because no shape in list
            Assert.IsFalse(s[0].Selected);
            //add shape into list
            myDrawing.AddShape(s[0]);
            //1 shape in list
            Assert.AreEqual(myDrawing.Count, 1);

            myDrawing.SelectShapesAt(point);
            //select
            Assert.IsTrue(s[0].Selected);
            //remove shape from list
            myDrawing.RemoveShape(s[0]);
            //no shape in list because removed
            Assert.AreEqual(myDrawing.Count, 0);


            myDrawing.SelectShapesAt(point);
            //can't be selected at point
            Assert.IsFalse(s[0].Selected, "should be false");
        }
        public void TestRemoveShape( )
        {
            Drawing myDrawing = new Drawing();

            Shape[] testShapes =
            {
                new Rectangle(Color.Red,   25, 25, 50, 50),
                new Rectangle(Color.Green, 25, 10, 50, 50),
                new Rectangle(Color.Blue,  10, 25, 50, 50)
            };

            Point2D      point;
            List <Shape> selected;
            Shape        shapeRemoved = testShapes [1];

            foreach (Shape s in testShapes)
            {
                myDrawing.AddShape(s);
            }

            point = SwinGame.PointAt(25, 10);
            myDrawing.SelectShapeAt(point);
            selected = myDrawing.SelectedShape;

            Assert.AreEqual(3, myDrawing.ShapeCount);
            CollectionAssert.Contains(selected, shapeRemoved);

            myDrawing.RemoveShape(shapeRemoved);
            selected = myDrawing.SelectedShape;

            myDrawing.SelectShapeAt(point);

            Assert.AreEqual(2, myDrawing.ShapeCount);
            CollectionAssert.DoesNotContain(selected, shapeRemoved);
        }
        public static void Main()
        {
            Drawing myDrawing = new Drawing();

            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
            SwinGame.ShowSwinGameSplashScreen();

            //Run the game loop
            while (false == SwinGame.WindowCloseRequested())
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();

                //Clear the screen and draw the framerate
                SwinGame.ClearScreen(Color.White);
                SwinGame.DrawFramerate(0, 0);


                myDrawing.Draw();

                //Draw onto the screen
                SwinGame.RefreshScreen(60);



                if (SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    SwinGame.FillCircle(Color.AliceBlue, 50, 50, 50);
                    Shape myShape = new Shape();
                    myShape.X = SwinGame.MouseX();
                    myShape.Y = SwinGame.MouseY();
                    myDrawing.AddShape(myShape);
                }

                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    SwinGame.GUISetBackgroundColor(SwinGame.RandomRGBColor(255));
                }

                if (SwinGame.MouseClicked(MouseButton.RightButton))
                {
                    myDrawing.SelectShapesAt(SwinGame.MousePosition());
                }

                if (SwinGame.KeyDown(KeyCode.vk_DELETE))
                {
                    foreach (Shape s in myDrawing.SelectedShapes)
                    {
                        myDrawing.RemoveShape(s);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public static void Main()
        {
            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
            //SwinGame.ShowSwinGameSplashScreen();
            Drawing myDrawing = new Drawing();

            //Run the game loop
            while (false == SwinGame.WindowCloseRequested())
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();

                //Clear the screen and draw the framerate
                myDrawing.Draw();
                SwinGame.DrawFramerate(0, 0);

                //Button Functions
                //spawn new shape
                if (SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    Shape s = new Shape();
                    s.X = SwinGame.MouseX();
                    s.Y = SwinGame.MouseY();
                    myDrawing.AddShape(s);
                }
                //randomise background color
                if (SwinGame.KeyTyped(KeyCode.SpaceKey))
                {
                    myDrawing.Background = SwinGame.RandomRGBColor(255);
                }
                //select
                if (SwinGame.MouseClicked(MouseButton.RightButton))
                {
                    myDrawing.SelectShapesAt(SwinGame.MousePosition());
                }
                //delete selected
                if ((SwinGame.KeyTyped(KeyCode.DeleteKey)) || (SwinGame.KeyTyped(KeyCode.BackspaceKey)))
                {
                    foreach (Shape selectedShape in myDrawing.SelectedShapes())
                    {
                        myDrawing.RemoveShape(selectedShape);
                    }
                }

                //Draw onto the screen
                SwinGame.RefreshScreen(60);
            }
        }
        public void RemoveShapeTest()
        {
            Drawing   drawing = new Drawing();
            Rectangle s       = new Rectangle();

            drawing.AddShape(s);
            Rectangle sh = new Rectangle(Color.AliceBlue, 100, 100, 50, 50);

            drawing.AddShape(sh);
            Assert.AreEqual(2, drawing.ShapeCount);
            drawing.RemoveShape(sh);
            Assert.AreEqual(1, drawing.ShapeCount);

            Assert.False(sh.Selected);
        }
Exemplo n.º 6
0
        public static void Main()
        {
            Drawing draw = new Drawing();

            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
            SwinGame.ShowSwinGameSplashScreen();

            //Run the game loop
            while (SwinGame.WindowCloseRequested() == false)
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();

                //Clear the screen and draw the framerate
                SwinGame.ClearScreen(Color.White);
                if (SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    Shape shape = new Shape();
                    shape.X = SwinGame.MouseX();
                    shape.Y = SwinGame.MouseY();
                    draw.AddShape(shape);
                }
                if (SwinGame.MouseClicked(MouseButton.RightButton))
                {
                    draw.SelectShapesAt(SwinGame.MousePosition());
                }
                if (SwinGame.KeyTyped(KeyCode.vk_DELETE) || SwinGame.KeyTyped(KeyCode.vk_BACKSPACE))
                {
                    foreach (Shape shape in draw.SelectedShapes)
                    {
                        draw.RemoveShape(shape);
                    }
                }
                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    draw.Background = SwinGame.RandomRGBColor(255);
                }
                SwinGame.DrawFramerate(0, 0);

                //Draw onto the screen
                SwinGame.RefreshScreen(60);
            }
        }
Exemplo n.º 7
0
        public void TestRemoveShape()
        {
            Drawing myDrawing = new Drawing ();

            Rectangle myShape1 = new Rectangle (Color.Red, 100, 100, 10, 50);
            Rectangle myShape2 = new Rectangle (Color.Green, 100, 100, 50, 50);
            Rectangle myShape3 = new Rectangle (Color.Blue, 100, 100, 50, 10);

            myDrawing.AddShape (myShape1);
            myDrawing.AddShape (myShape2);
            myDrawing.AddShape (myShape3);

            Point2D pt = SwinGame.PointAt (100, 100);

            Assert.AreEqual (3, myDrawing.ShapeCount);

            myDrawing.RemoveShape (myShape2);

            Assert.AreEqual (2, myDrawing.ShapeCount);

            myDrawing.SelectShapesAt(pt);

            Assert.IsFalse (myShape2.Selected);
        }
Exemplo n.º 8
0
        public static void Main()
        {
            Drawing   myDrawing = new Drawing();
            ShapeKind KindToAdd = ShapeKind.Circle;

            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
            SwinGame.ShowSwinGameSplashScreen();

            //Run the game loop
            while (SwinGame.WindowCloseRequested() == false)
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();

                //Clear the screen and myDrawing the framerate
                SwinGame.ClearScreen(Color.White);

                if (SwinGame.KeyTyped(KeyCode.vk_r))
                {
                    KindToAdd = ShapeKind.Rectangle;
                }
                else if (SwinGame.KeyTyped(KeyCode.vk_c))
                {
                    KindToAdd = ShapeKind.Circle;
                }
                else if (SwinGame.KeyTyped(KeyCode.vk_l))
                {
                    KindToAdd = ShapeKind.Line;
                }

                if (SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    Shape newShape;

                    switch (KindToAdd)
                    {
                    case ShapeKind.Circle:
                        newShape = new Circle();
                        break;

                    case ShapeKind.Rectangle:
                        newShape = new Rectangle();
                        break;

                    case ShapeKind.Line:
                        newShape = new Line();
                        break;

                    default:
                        newShape = new Rectangle();
                        break;
                    }

                    newShape.X = SwinGame.MouseX();
                    newShape.Y = SwinGame.MouseY();
                    myDrawing.AddShape(newShape);
                }
                if (SwinGame.MouseClicked(MouseButton.RightButton))
                {
                    myDrawing.SelectShapesAt(SwinGame.MousePosition());
                }
                if (SwinGame.KeyTyped(KeyCode.vk_DELETE) || SwinGame.KeyTyped(KeyCode.vk_BACKSPACE))
                {
                    foreach (Shape shape in myDrawing.SelectedShapes)
                    {
                        myDrawing.RemoveShape(shape);
                    }
                }
                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    myDrawing.Background = SwinGame.RandomRGBColor(255);
                }
                myDrawing.Draw();
                SwinGame.DrawFramerate(0, 0);

                //myDrawing onto the screen
                SwinGame.RefreshScreen(60);
            }
        }
        public static void Main()
        {
            Drawing myDrawing = new Drawing();

            ShapeKind kindToAdd = ShapeKind.Circle;

            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
            SwinGame.ShowSwinGameSplashScreen();

            //Run the game loop
            while (false == SwinGame.WindowCloseRequested())
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();

                //Clear the screen and draw the framerate
                SwinGame.ClearScreen(Color.White);
                SwinGame.DrawFramerate(0, 0);


                myDrawing.Draw();

                //Draw onto the screen
                SwinGame.RefreshScreen(60);



                if (SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    Shape newShape;

                    if (kindToAdd == ShapeKind.Circle)
                    {
                        Circle newCircle = new Circle();

                        newShape = newCircle;
                    }

                    else if (kindToAdd == ShapeKind.Line)
                    {
                        Line newLine = new Line();

                        newShape = newLine;
                    }


                    else
                    {
                        Rectangle newRect = new Rectangle();

                        newShape = newRect;
                    }

                    myDrawing.AddShape(newShape);
                }



                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    SwinGame.GUISetBackgroundColor(SwinGame.RandomRGBColor(255));
                }

                if (SwinGame.MouseClicked(MouseButton.RightButton))
                {
                    myDrawing.SelectShapesAt(SwinGame.MousePosition());
                }

                if (SwinGame.KeyDown(KeyCode.vk_DELETE))
                {
                    foreach (Shape s in myDrawing.SelectedShapes)
                    {
                        myDrawing.RemoveShape(s);
                    }
                }

                if (SwinGame.KeyDown(KeyCode.vk_r))
                {
                    kindToAdd = ShapeKind.Rectangle;
                }

                if (SwinGame.KeyDown(KeyCode.vk_c))
                {
                    kindToAdd = ShapeKind.Circle;
                }

                if (SwinGame.KeyDown(KeyCode.vk_l))
                {
                    kindToAdd = ShapeKind.Line;
                }
            }
        }
Exemplo n.º 10
0
        public static void Main()
        {
            ShapeKind kindToAdd = ShapeKind.Circle;

            //Start the audio system so sound can be played
            SwinGame.OpenAudio();

            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
               // SwinGame.ShowSwinGameSplashScreen();

            Drawing myDrawing = new Drawing ();

            //Run the game loop
            while(false == SwinGame.WindowCloseRequested())
            {
                if (SwinGame.KeyTyped (KeyCode.vk_r))
                {
                    kindToAdd = ShapeKind.Rectangle;
                }

                if (SwinGame.KeyTyped (KeyCode.vk_c))
                {
                    kindToAdd = ShapeKind.Circle;
                }

                if (SwinGame.KeyTyped (KeyCode.vk_l))
                {
                    kindToAdd = ShapeKind.Line;
                }

                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();

                //Clear the screen and draw the framerate
                SwinGame.ClearScreen(Color.White);

                //Change location of shape
                if (SwinGame.MouseClicked(MouseButton.LeftButton))
                {
                    Shape newShape;

                    if (kindToAdd == ShapeKind.Circle)
                    {
                        Circle newCircle = new Circle ();
                        newShape = newCircle;
                    }
                    else if (kindToAdd == ShapeKind.Rectangle)
                    {
                        Rectangle newRect = new Rectangle ();
                        newShape = newRect;
                    }
                    else
                    {
                        Line newLine = new Line ();
                        newShape = newLine;
                    }

                    newShape.X = SwinGame.MouseX ();
                    newShape.Y = SwinGame.MouseY ();

                    myDrawing.AddShape (newShape);
                }

                if (SwinGame.MouseClicked (MouseButton.RightButton))
                {
                    myDrawing.SelectShapesAt (SwinGame.MousePosition ());
                }

                //Check if mouse is within shape bounds and spacebar pressed
                //If true change color of shape to random RGB color
                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    myDrawing.BackgroundColor = SwinGame.RandomRGBColor (255);
                }

                if ((SwinGame.KeyTyped (KeyCode.vk_DELETE)) || (SwinGame.KeyTyped (KeyCode.vk_BACKSPACE)))
                {
                    foreach (Shape s in myDrawing.SelectedShapes)
                    {
                        myDrawing.RemoveShape (s);
                    }
                }

                SwinGame.DrawFramerate(0,0);

                myDrawing.Draw ();

                //Draw onto the screen
                SwinGame.RefreshScreen();
            }

            //End the audio
            SwinGame.CloseAudio();

            //Close any resources we were using
            SwinGame.ReleaseAllResources();
        }
Exemplo n.º 11
0
        public static void Main()
        {
            Shape.RegisterShape("Rectangle", typeof(Rectangle));
            Shape.RegisterShape("Circle", typeof(Circle));
            Shape.RegisterShape("Line", typeof(Line));


            //Start the audio system so sound can be played
//            SwinGame.OpenAudio();

            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
//            SwinGame.ShowSwinGameSplashScreen();

            ShapeKind kindToAdd = ShapeKind.Circle;
            Drawing   mydrawing = new Drawing();

            do
            {
                mydrawing.FreeList();
                SwinGame.ClearScreen(Color.White);
                SwinGame.DrawFramerate(0, 0);
                SwinGame.RefreshScreen();
                /*Shape s = new Shape ();*/
                //Run the game loop
                while (!SwinGame.WindowCloseRequested())
                {
                    //Fetch the next batch of UI interaction
                    SwinGame.ProcessEvents();

                    //Clear the screen and draw the framerate
                    SwinGame.ClearScreen(Color.White);
                    SwinGame.DrawFramerate(0, 0);

                    Random rand = new Random();
                    Shape  s    = default(Shape);


                    mydrawing.Draw();
                    if (Input.KeyTyped(KeyCode.vk_r))
                    {
                        kindToAdd = ShapeKind.Rectangle;
                    }
                    if (Input.KeyTyped(KeyCode.vk_c))
                    {
                        kindToAdd = ShapeKind.Circle;
                    }
                    if (Input.KeyTyped(KeyCode.vk_l))
                    {
                        kindToAdd = ShapeKind.Line;
                    }
                    if (Input.KeyTyped(KeyCode.vk_s))
                    {
                        mydrawing.Save("File.txt");
                    }

                    if (Input.KeyDown(KeyCode.vk_KP_ENTER))
                    {
                        try
                        { mydrawing.Load("File.txt"); }
                        catch (Exception e)
                        {
                            Console.Error.WriteLine("Error loading file:{0}", e.Message);
                        }
                    }


                    if (SwinGame.MouseClicked(MouseButton.LeftButton))
                    {
                        //code written before inheritance
                        //					s.X = SwinGame.MouseX ();
                        //					s.Y = SwinGame.MouseY ();

                        //  done previously when abstract is not done->
                        //	->Shape newShape = new Shape ();

                        switch (kindToAdd)
                        {
                        case ShapeKind.Circle:
                            Circle newCircle = new Circle();
                            newCircle.X      = SwinGame.MouseX();
                            newCircle.Y      = SwinGame.MouseY();
                            newCircle.Radius = (int)(rand.NextDouble() * 100);
                            Console.WriteLine("(" + newCircle.X + "," + newCircle.Y + ")");

                            s = newCircle;
                            break;

                        case ShapeKind.Rectangle:
                            Rectangle newRect = new Rectangle();
                            newRect.Width  = (int)(rand.NextDouble() * 400);
                            newRect.Height = (int)(rand.NextDouble() * 400);
                            newRect.X      = SwinGame.MouseX() - newRect.Width / 2;
                            newRect.Y      = SwinGame.MouseY() - newRect.Height / 2;
                            Console.WriteLine("(" + newRect.X + "," + newRect.Y + ")");

                            s = newRect;
                            break;

                        case ShapeKind.Line:

                            Line newLine = new Line();
                            newLine.X = SwinGame.MouseX();
                            newLine.Y = SwinGame.MouseY();
                            //						//center of the program is about (400,300)
                            newLine.XEnd = (int)(rand.NextDouble() * 800);
                            newLine.YEnd = (int)(rand.NextDouble() * 600);
                            s            = newLine;
                            break;

                        default:
                            break;
                        }
                        mydrawing.AddShape(s);
                    }


                    if (Input.KeyDown(KeyCode.vk_SPACE))
                    {
                        mydrawing.BackgroundColor = SwinGame.RandomRGBColor(255);
                    }

                    if (SwinGame.MouseClicked(MouseButton.RightButton))
                    {
                        mydrawing.SelectShapesAt(SwinGame.MousePosition());
                        //done previously when abstract is not done
                        //					if (s is Rectangle)
                        //						(s as Rectangle).DrawOutline ();
                        //					if (s is Circle)
                        //						(s as Circle).DrawOutline ();
                        //					else if (s is Line)
                        //						(s as Line).DrawOutline ();
                    }
                    foreach (Shape Shapes in mydrawing.SelectedShapes)
                    {
                        if (Input.KeyTyped(KeyCode.vk_BACKSPACE) || Input.KeyTyped(KeyCode.vk_DELETE))
                        {
                            mydrawing.RemoveShape(Shapes);
                            //						if (s is Rectangle)
                            //							(s as Rectangle).DrawOutline ();
                            //						if (s is Circle)
                            //							(s as Circle).DrawOutline ();
                            //						else if (s is Line)
                            //							(s as Line).DrawOutline ();
                        }
                    }

                    //Draw onto the screen
                    SwinGame.RefreshScreen();
                }

                //End the audio
                SwinGame.CloseAudio();

                //Close any resources we were using
                SwinGame.ReleaseAllResources();
            }while(Input.KeyTyped(KeyCode.vk_z));
        }
        public static void Main()
        {
            SwinGame.OpenAudio();
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
            SwinGame.ShowSwinGameSplashScreen();

            Drawing myDrawing = new Drawing();

            ShapeKind KindtoAdd = ShapeKind.Circle;


            while (false == SwinGame.WindowCloseRequested())
            {
                SwinGame.ProcessEvents();

                SwinGame.ClearScreen(Color.White);
                SwinGame.DrawFramerate(0, 0);

                myDrawing.Draw();

                if (Input.KeyTyped(KeyCode.vk_r))
                {
                    KindtoAdd = ShapeKind.Rectangle;
                }
                if (Input.KeyTyped(KeyCode.vk_c))
                {
                    KindtoAdd = ShapeKind.Circle;
                }
                if (Input.KeyTyped(KeyCode.vk_l))
                {
                    KindtoAdd = ShapeKind.Line;
                }

                Point2D mouseLocation = SwinGame.MousePosition();


                if (SwinGameSDK.Input.MouseClicked(MouseButton.LeftButton))
                {
                    /*Shape myShape = new Shape();
                     * myShape.Color = SwinGame.RandomRGBColor (255);
                     * myShape.X = SwinGame.MouseX();
                     * myShape.Y = SwinGame.MouseY();
                     * myDrawing.AddShape (myShape);*/

                    Shape newShape = default(Shape);
                    if (KindtoAdd == ShapeKind.Circle)
                    {
                        Circle newCircle = new Circle();
                        newCircle.X = SwinGame.MouseX();
                        newCircle.Y = SwinGame.MouseY();
                        newShape    = newCircle;
                    }
                    else if (KindtoAdd == ShapeKind.Rectangle)
                    {
                        Rectangle newRect = new Rectangle();
                        newRect.X = SwinGame.MouseX();
                        newRect.Y = SwinGame.MouseY();
                        newShape  = newRect;
                    }
                    else if (KindtoAdd == ShapeKind.Line)
                    {
                        Line newLine = new Line();
                        newLine.X = SwinGame.MouseX();
                        newLine.Y = SwinGame.MouseY();
                        newShape  = newLine;
                    }
                    myDrawing.AddShape(newShape);
                }

                if (SwinGame.MouseClicked(MouseButton.RightButton))
                {
                    myDrawing.SelectShapeAt(SwinGame.MousePosition());
                }
                if (SwinGame.KeyTyped(KeyCode.vk_DELETE))
                {
                    List <Shape> selected = myDrawing.SelectedShape;
                    foreach (Shape s in selected)
                    {
                        myDrawing.RemoveShape(s);
                    }
                }

                //if (myShape.IsAt (mouseLocation))
                //{
                if (SwinGame.KeyTyped(KeyCode.vk_SPACE))
                {
                    myDrawing.Mybackground = SwinGame.RandomRGBColor(255);
                }
                //}
                SwinGame.DrawFramerate(0, 0);
                SwinGame.RefreshScreen();
            }


            //End the audio
            SwinGame.CloseAudio();

            //Close any resources we were using
            SwinGame.ReleaseAllResources();
        }
Exemplo n.º 13
0
        public static void Main()
        {
            ShapeKind kindToAdd = ShapeKind.Circle;
            Drawing   drawing   = new Drawing();

            //Open the game window
            Core.OpenGraphicsWindow("GameMain", 768, 600);
            do
            {
                if (Core.MouseClicked(MouseButton.RightButton))
                {
                    if (Core.MouseClicked(MouseButton.RightButton))
                    {
                        drawing.SelectedShapesAt(Core.MousePosition());
                        drawing.Draw();
                    }
                }
                if (Core.MouseClicked(MouseButton.LeftButton))
                {
                    Point2D cur_pos = Core.MousePosition();
                    Shape   newShape;
                    if (kindToAdd == ShapeKind.Rectangle)
                    {
                        newShape = new Rectangle(Color.Green, cur_pos.X, cur_pos.Y, 100, 100);
                        drawing.AddShape(newShape);
                    }
                    if (kindToAdd == ShapeKind.Circle)
                    {
                        newShape = new Circle(Color.Blue, cur_pos.X, cur_pos.Y, 50);
                        drawing.AddShape(newShape);
                    }
                    if (kindToAdd == ShapeKind.Line)
                    {
                        newShape = new Line(Color.Red, cur_pos.X, cur_pos.Y);
                        drawing.AddShape(newShape);
                    }
                    drawing.Draw();
                }

                if (Core.KeyTyped(KeyCode.vk_SPACE))
                {
                    drawing.backgroundColor = Shape.getRandomColor();
                    Core.ClearScreen(drawing.backgroundColor);
                    drawing.Draw();
                }

                if (Core.KeyTyped(KeyCode.vk_DELETE) || Core.KeyTyped(KeyCode.vk_BACKSPACE))
                {
                    foreach (Shape s in drawing.SelectedShape)
                    {
                        drawing.RemoveShape(s);
                    }
                    drawing.Draw();
                }

                if (Core.KeyTyped(KeyCode.vk_r))
                {
                    kindToAdd = ShapeKind.Rectangle;
                }

                if (Core.KeyTyped(KeyCode.vk_c))
                {
                    kindToAdd = ShapeKind.Circle;
                }

                if (Core.KeyTyped(KeyCode.vk_l))
                {
                    kindToAdd = ShapeKind.Line;
                }

                Core.ProcessEvents();
                Core.RefreshScreen();
                Core.ProcessEvents();
            } while(!Core.WindowCloseRequested());
        }