Ejemplo n.º 1
0
 static void Keyboard_KeyDown(KeyDownEventArgs e)
 {
     switch (e.KeyConfig.Key)
     {
         case Keys.Up:
             if (e.IsShift)
                 //matrix.SetSourceGridPoint(new PointF(matrix.SourceGridPoint.X, matrix.SourceGridPoint.Y - (float).1));
                 matrix.VelocityY = -1;
             //else
             //    //sprite.MoveSprite(sprite.GridCoordinates.X, sprite.GridCoordinates.Y - .1);
             //    sprite.SpriteMovement.VelocityY = -1;
             break;
         case Keys.Down:
             if (e.IsShift)
                 //matrix.SetSourceGridPoint(new PointF(matrix.SourceGridPoint.X, matrix.SourceGridPoint.Y + (float).1));
                 matrix.VelocityY = 1;
             //else
             //    //sprite.MoveSprite(sprite.GridCoordinates.X, sprite.GridCoordinates.Y + .1);
             //    sprite.SpriteMovement.VelocityY = 1;
             break;
         case Keys.Left:
             if (e.IsShift)
                 //matrix.SetSourceGridPoint(new PointF(matrix.SourceGridPoint.X - (float).1, matrix.SourceGridPoint.Y));
                 matrix.VelocityX = -1;
             //else
             //    //sprite.MoveSprite(sprite.GridCoordinates.X - 0.1, sprite.GridCoordinates.Y);
             //    sprite.SpriteMovement.VelocityX = -1;
             break;
         case Keys.Right:
             if (e.IsShift)
                 //matrix.SetSourceGridPoint(new PointF(matrix.SourceGridPoint.X + (float).1, matrix.SourceGridPoint.Y));
                 matrix.VelocityX = 1;
             //else
             //    //sprite.MoveSprite(sprite.GridCoordinates.X + 0.1, sprite.GridCoordinates.Y);
             //    sprite.SpriteMovement.VelocityX = 1;
             break;
         case Keys.A:
             matrix.Visible = true;
             break;
         case Keys.S:
             matrix.Visible = false;
             break;
         case Keys.X:
             Sprites.PauseAllAnimation(true);
             break;
         case Keys.Y:
             Sprites.PauseAllAnimation(false);
             break;
         case Keys.Escape:
             stopEngine = true;
             break;
         case Keys.Q:
             sprite.TileAnimator.StopAnimation();
             break;
         case Keys.Z:
             sprite.TileAnimator.StartAnimation();
             break;
         case Keys.D:
             sprite.Dispose();
             sprite = null;
             DirectDrawing.Clear();
             MediaFile.GetMediaFile("boom").Play();;
             break;
         case Keys.C:
             //Sprite cloned = (Sprite)sprite.Clone();
             //cloned.TileAnimator.StartAnimation("groovin");
             MediaFile.GetMediaFile("chicken").Play();
             break;
         case Keys.V:
             //MediaFile.FullScreen = !MediaFile.FullScreen;
             break;
         case Keys.B:
             //DirectDrawing.ClearAll();
             Text text = new Text(visSurf, "BEWARE THE HORNY CHICKENS",
                 new Font("Times New Roman", 24), new Rectangle(200, 200, 700, 100),
                 Color.Orange, Color.Transparent, TextFormatFlags.WordBreak | TextFormatFlags.HorizontalCenter);
             break;
         case Keys.W:
             matrix.WrapHorizontally = !matrix.WrapHorizontally;
             //matrix3.WrapHorizontally = !matrix3.WrapHorizontally;
             break;
         default:
             break;
     }
 }
Ejemplo n.º 2
0
        public static void LoadVisibleSurfaces(Form1 frm)
        {
            Graphics g = frm.CreateGraphics();
            visSurf = new VisibleSurface(g, frm.Width, frm.Height);
            visSurf.Bind(layers);

            layers[0].ShowGridLines = false;
            layers[1].ShowGridLines = false;

            visSurf.RedrawDirtyRectangleOnly = true;

            fpsCounter = new Text(visSurf, "fps:", new Font("Times New Roman", 8),
                new Rectangle(0, 0, 200, 300), Color.White, Color.Transparent);

            Engine.CPSCalculated += new Gondwana.Common.EventArgs.CyclesPerSecondCalculatedHandler(Engine_CPSCalculated);
        }