public override void HandlerInput(InputState input) { if (input.CurrentState.IsKeyDown(key) && !input.LastKeyState.IsKeyDown(key)) { do { ctrl.dropBox.MoveDown(); } while (ctrl.dropBox.position.Y > -BoxUtil.getTop(ctrl.dropBox.boxData) * DropBox.size); } }
public override void HandlerInput(InputState input) { if (!input.LastKeyState.IsKeyDown(key) && input.CurrentState.IsKeyDown(key)) { int size = Directory.GetFiles(@"Content\imgs", "bg?.xnb", SearchOption.TopDirectoryOnly).Length; if (ctrl.currentBG == size) ctrl.currentBG = 0; ctrl.bigStage.Stop(); Texture2D bg = (Texture2D)ctrl.lib["bg" + ++ctrl.currentBG]; ctrl.bigStage.NewBackground = bg; ctrl.bigStage.NewBackgroundIndex = ctrl.currentBG; } }
public override void HandlerInput(InputState input) { if (input.CurrentState.IsKeyDown(key) && !input.LastKeyState.IsKeyDown(key)) { Microsoft.Xna.Framework.Rectangle rec = ctrl.tetris.Window.ClientBounds; Image img = new Bitmap(rec.Width, rec.Height); Graphics graphics = Graphics.FromImage(img); graphics.CopyFromScreen(new Point(rec.X, rec.Y), new Point(0, 0), new Size(rec.Width, rec.Height)); /* 保存剪贴板 */ Clipboard.SetImage(img); //DateTime dateTime = System.DateTime.Now; /* 保存至文件 */ //img.Save(dateTime.Year + "-" + dateTime.Month + "-" + dateTime.Day + " " + // dateTime.Hour + ";" + dateTime.Minute + ";" + dateTime.Second + ".png"); graphics.Dispose(); img.Dispose(); } }
/// <summary> /// 初始化对象 /// </summary> public void InitObjects() { Rectangle clientBounds = tetris.Window.ClientBounds; BigStage.AlphaChange = AlphaChange; bigStage = new BigStage(tetris); /* 在整个场景的中间绘制游戏场景 */ DropBox.size = boxSize; gameStage = new GameStage(new Rectangle((clientBounds.Width - gameStageWidth) / 2, (clientBounds.Height - gameStageHeight) / 2, gameStageWidth, gameStageHeight), tetris); pointStage = new PointStage(tetris); dropBox = new DropBox(tetris); input = new InputState(); table = new Hashtable(); DropBoxThread = new Thread(new ThreadStart(dropBox.AutoDrop)); lib = new ResourcesLIB(tetris.Content); }
public override void HandlerInput(InputState input) { if (!input.LastKeyState.IsKeyDown(key) && input.CurrentState.IsKeyDown(key)) { ctrl.dropBox.TurnRight(); } }
public abstract void HandlerInput(InputState input);
public override void HandlerInput(InputState input) { if (input.CurrentState.IsKeyDown(key) && !input.LastKeyState.IsKeyDown(key)) { ctrl.dropBox.MoveLeft(); } }
public override void HandlerInput(InputState input) { if (!input.LastKeyState.IsKeyDown(key) && input.CurrentState.IsKeyDown(key)) { ctrl.tetris.Exit(); } }