public static void Main()
        {
            Core.OpenGraphicsWindow("bg", 768, 600);

            do
            {
                Core.ClearScreen(Color.Red);
                Core.ProcessEvents();
                Core.RefreshScreen();
                Core.GUISetBackgroundColor(Color.Black);
                Core.GUISetBackgroundColor(Color.Green);
                Core.GUISetBackgroundColorInactive(Color.Red);
                Core.RefreshScreen();
                Core.ProcessEvents();
                Core.RefreshScreen();
            } while(!Core.WindowCloseRequested());
        }
Exemplo n.º 2
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());
        }