当前位置: 首页>>代码示例>>C#>>正文


C# InputHelper.IsNewKeyPress方法代码示例

本文整理汇总了C#中InputHelper.IsNewKeyPress方法的典型用法代码示例。如果您正苦于以下问题:C# InputHelper.IsNewKeyPress方法的具体用法?C# InputHelper.IsNewKeyPress怎么用?C# InputHelper.IsNewKeyPress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputHelper的用法示例。


在下文中一共展示了InputHelper.IsNewKeyPress方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleInput

        public override void HandleInput(InputHelper input)
        {
            //Xbox
            if (input.IsNewButtonPress(Buttons.Start))
            {
                EnableOrDisableFlag(DebugViewFlags.Shape);
                EnableOrDisableFlag(DebugViewFlags.DebugPanel);
                EnableOrDisableFlag(DebugViewFlags.PerformanceGraph);
            }
            if (input.IsNewButtonPress(Buttons.Back))
            {
                ExitScreen();
            }

            //Windows
            if (input.IsNewKeyPress(Keys.F1))
            {
                EnableOrDisableFlag(DebugViewFlags.Shape);
            }
            else if (input.IsNewKeyPress(Keys.F2))
            {
                EnableOrDisableFlag(DebugViewFlags.DebugPanel);
            }
            else if (input.IsNewKeyPress(Keys.F3))
            {
                EnableOrDisableFlag(DebugViewFlags.PerformanceGraph);
            }
            else if (input.IsNewKeyPress(Keys.F4))
            {
                EnableOrDisableFlag(DebugViewFlags.AABB);
            }
            else if (input.IsNewKeyPress(Keys.F5))
            {
                EnableOrDisableFlag(DebugViewFlags.CenterOfMass);
            }
            else if (input.IsNewKeyPress(Keys.F6))
            {
                EnableOrDisableFlag(DebugViewFlags.Joint);
            }
            else if (input.IsNewKeyPress(Keys.F7))
            {
                EnableOrDisableFlag(DebugViewFlags.ContactPoints);
                EnableOrDisableFlag(DebugViewFlags.ContactNormals);
            }
            else if (input.IsNewKeyPress(Keys.F8))
            {
                EnableOrDisableFlag(DebugViewFlags.PolygonPoints);
            }

            if (input.IsNewKeyPress(Keys.Escape))
            {
                ExitScreen();
            }

            if (World != null)
            {
            #if XBOX
                GamePad(input.CurrentGamePadState, input.LastGamePadState);
            #else
                Mouse(input);
            #endif
            }

            base.HandleInput(input);
        }
开发者ID:tomasmcguinness,项目名称:Bounce,代码行数:65,代码来源:PhysicsGameScreen.cs

示例2: HandleInput

        public override void HandleInput( InputHelper input, GameTime gameTime )
        {
            if ( input.VirtualState.ThumbSticks.Left.X > 0.5f || input.GamePadState.IsButtonDown( Buttons.RightTrigger ) ) {
                _acceleration = Math.Min( _acceleration + (float)( 2.0 * gameTime.ElapsedGameTime.TotalSeconds ), 1f );
            } else if ( input.VirtualState.ThumbSticks.Left.X < -0.5f || input.GamePadState.IsButtonDown( Buttons.LeftTrigger ) ) {
                _acceleration = Math.Max( _acceleration - (float)( 2.0 * gameTime.ElapsedGameTime.TotalSeconds ), -1f );
            } else if ( input.VirtualState.Buttons.A == ButtonState.Pressed ) {
                _acceleration = 0f;
            } else if ( input.IsNewKeyPress(Keys.R) || input.IsNewButtonPress(Buttons.X )) {
                _car.Rotation = 0;
                _car.Position += ConvertUnits.ToSimUnits( 0, -100 );
            } else {
                _acceleration -= Math.Sign( _acceleration ) * (float)( 2.0 * gameTime.ElapsedGameTime.TotalSeconds );
            }

            base.HandleInput( input, gameTime );
        }
开发者ID:headdetect,项目名称:Circular,代码行数:17,代码来源:LevelTutorial.cs

示例3: HandleInput

        public override void HandleInput(InputHelper input, GameTime gameTime)
        {
            // Control debug view
            if (input.IsNewButtonPress(Buttons.Start))
            {
                EnableOrDisableFlag(DebugViewFlags.Shape);
                EnableOrDisableFlag(DebugViewFlags.DebugPanel);
                EnableOrDisableFlag(DebugViewFlags.PerformanceGraph);
                EnableOrDisableFlag(DebugViewFlags.Joint);
                EnableOrDisableFlag(DebugViewFlags.ContactPoints);
                EnableOrDisableFlag(DebugViewFlags.ContactNormals);
                EnableOrDisableFlag(DebugViewFlags.Controllers);
            }

            if (input.IsNewKeyPress(Keys.F1))
            {
                EnableOrDisableFlag(DebugViewFlags.Shape);
            }
            if (input.IsNewKeyPress(Keys.F2))
            {
                EnableOrDisableFlag(DebugViewFlags.DebugPanel);
                EnableOrDisableFlag(DebugViewFlags.PerformanceGraph);
            }
            if (input.IsNewKeyPress(Keys.F3))
            {
                EnableOrDisableFlag(DebugViewFlags.Joint);
            }
            if (input.IsNewKeyPress(Keys.F4))
            {
                EnableOrDisableFlag(DebugViewFlags.ContactPoints);
                EnableOrDisableFlag(DebugViewFlags.ContactNormals);
            }
            if (input.IsNewKeyPress(Keys.F5))
            {
                EnableOrDisableFlag(DebugViewFlags.PolygonPoints);
            }
            if (input.IsNewKeyPress(Keys.F6))
            {
                EnableOrDisableFlag(DebugViewFlags.Controllers);
            }
            if (input.IsNewKeyPress(Keys.F7))
            {
                EnableOrDisableFlag(DebugViewFlags.CenterOfMass);
            }
            if (input.IsNewKeyPress(Keys.F8))
            {
                EnableOrDisableFlag(DebugViewFlags.AABB);
            }

            if (input.IsNewButtonPress(Buttons.Back) || input.IsNewKeyPress(Keys.Escape))
            {
                ExitScreen();
            }

            if (HasCursor)
            {
                HandleCursor(input);
            }

            if (_userAgent != null)
            {
                HandleUserAgent(input);
            }

            if (EnableCameraControl)
            {
                HandleCamera(input, gameTime);
            }

            base.HandleInput(input, gameTime);
        }
开发者ID:pducic,项目名称:incredible-107-108,代码行数:71,代码来源:PhysicsGameScreen.cs

示例4: HandleCamera

        private void HandleCamera(InputHelper input, GameTime gameTime)
        {
            Vector2 camMove = Vector2.Zero;

            if (input.KeyboardState.IsKeyDown(Keys.Up))
            {
                camMove.Y -= 10f * (float)gameTime.ElapsedGameTime.TotalSeconds;
            }
            if (input.KeyboardState.IsKeyDown(Keys.Down))
            {
                camMove.Y += 10f * (float)gameTime.ElapsedGameTime.TotalSeconds;
            }
            if (input.KeyboardState.IsKeyDown(Keys.Left))
            {
                camMove.X -= 10f * (float)gameTime.ElapsedGameTime.TotalSeconds;
            }
            if (input.KeyboardState.IsKeyDown(Keys.Right))
            {
                camMove.X += 10f * (float)gameTime.ElapsedGameTime.TotalSeconds;
            }
            if (input.KeyboardState.IsKeyDown(Keys.PageUp))
            {
                Camera.Zoom += 5f * (float)gameTime.ElapsedGameTime.TotalSeconds * Camera.Zoom / 20f;
            }
            if (input.KeyboardState.IsKeyDown(Keys.PageDown))
            {
                Camera.Zoom -= 5f * (float)gameTime.ElapsedGameTime.TotalSeconds * Camera.Zoom / 20f;
            }
            if (camMove != Vector2.Zero)
            {
                Camera.MoveCamera(camMove);
            }
            if (input.IsNewKeyPress(Keys.Home))
            {
                Camera.ResetCamera();
            }
        }
开发者ID:pducic,项目名称:incredible-107-108,代码行数:37,代码来源:PhysicsGameScreen.cs

示例5: HandleCursor

        private void HandleCursor(InputHelper nInput)
        {
            Vector2 position = mCamera.ConvertScreenToWorld(nInput.Cursor);

            if ((nInput.IsNewKeyPress(Keys.A) ||
                 nInput.IsNewMouseButtonPress(MouseButtons.LeftButton)) &&
                _fixedMouseJoint == null)
            {
                Fixture savedFixture = mWorld.TestPoint(position);
                if (savedFixture != null)
                {
                    Body body = savedFixture.Body;
                    _fixedMouseJoint = new FixedMouseJoint(body, position);
                    _fixedMouseJoint.MaxForce = 1000.0f * body.Mass;
                    mWorld.AddJoint(_fixedMouseJoint);
                    body.Awake = true;
                }
            }

            if ((nInput.IsNewKeyRelease(Keys.A) ||
                 nInput.IsNewMouseButtonRelease(MouseButtons.LeftButton)) &&
                _fixedMouseJoint != null)
            {
                mWorld.RemoveJoint(_fixedMouseJoint);
                _fixedMouseJoint = null;
            }

            if (_fixedMouseJoint != null)
            {
                _fixedMouseJoint.WorldAnchorB = position;
            }
        }
开发者ID:WilHall,项目名称:hakyn-client,代码行数:32,代码来源:Level.cs

示例6: HandleInput

        public override void HandleInput(InputHelper nInput, GameTime nGameTime)
        {
            // Control debug views
            if (nInput.IsNewKeyPress(Keys.F1))
            {
                EnableOrDisableFlag(DebugViewFlags.Shape);
            }
            if (nInput.IsNewKeyPress(Keys.F2))
            {
                EnableOrDisableFlag(DebugViewFlags.DebugPanel);
                EnableOrDisableFlag(DebugViewFlags.PerformanceGraph);
            }
            if (nInput.IsNewKeyPress(Keys.F3))
            {
                EnableOrDisableFlag(DebugViewFlags.Joint);
            }
            if (nInput.IsNewKeyPress(Keys.F4))
            {
                EnableOrDisableFlag(DebugViewFlags.ContactPoints);
                EnableOrDisableFlag(DebugViewFlags.ContactNormals);
            }
            if (nInput.IsNewKeyPress(Keys.F5))
            {
                EnableOrDisableFlag(DebugViewFlags.PolygonPoints);
            }
            if (nInput.IsNewKeyPress(Keys.F6))
            {
                EnableOrDisableFlag(DebugViewFlags.Controllers);
            }
            if (nInput.IsNewKeyPress(Keys.F7))
            {
                EnableOrDisableFlag(DebugViewFlags.CenterOfMass);
            }
            if (nInput.IsNewKeyPress(Keys.F8))
            {
                EnableOrDisableFlag(DebugViewFlags.AABB);
            }

            if (nInput.IsNewKeyPress(Keys.Back) || nInput.IsNewKeyPress(Keys.Escape))
            {
                ExitScreen();
            }

            if (HasCursor)
            {
                HandleCursor(nInput);
            }

            //Pass nInput on to player
            mPlayer.HandleInput(nInput);
        }
开发者ID:WilHall,项目名称:hakyn-client,代码行数:51,代码来源:Level.cs


注:本文中的InputHelper.IsNewKeyPress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。