Пример #1
0
        public void Main(string[] args)
        {
            using (AgateSetup setup = new AgateSetup(args))
            {
                setup.Initialize(true, false, false);

                if (setup.WasCanceled)
                {
                    return;
                }

                DisplayWindow wind = DisplayWindow.CreateWindowed("Rotating sprite", 300, 300);
                Sprite        sp   = new Sprite("spike.png", 16, 16);

                sp.RotationCenter   = OriginAlignment.Center;
                sp.DisplayAlignment = OriginAlignment.Center;

                sp.RotationAngleDegrees = 90;
                sp.SetScale(2, 2);

                Point location = new Point(150, 100);

                while (wind.IsClosed == false)
                {
                    Display.BeginFrame();
                    Display.Clear(Color.DarkRed);

                    sp.RotationAngleDegrees += 180 * Display.DeltaTime / 1000.0;
                    sp.Draw(location);

                    Display.DrawRect(location.X, location.Y, 1, 1, Color.YellowGreen);

                    Display.EndFrame();
                    Core.KeepAlive();

                    if (Keyboard.Keys[KeyCode.F5])
                    {
                        if (wind.IsFullScreen)
                        {
                            wind.SetWindowed();
                            wind.Size = new Size(500, 500);
                        }
                        else
                        {
                            wind.SetFullScreen(800, 600, 32);
                        }

                        Keyboard.ReleaseKey(KeyCode.F5);
                    }
                    if (Keyboard.Keys[KeyCode.Escape])
                    {
                        return;
                    }
                }
            }
        }