• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Input类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Input的典型用法代码示例。如果您正苦于以下问题:C# Input类的具体用法?C# Input怎么用?C# Input使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Input类属于命名空间,在下文中一共展示了Input类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Update

        protected override void Update(TimeSpan gameTime)
        {
            input = WaveServices.Input;

            if (input.KeyboardState.IsConnected)
            {
                keyboardState = input.KeyboardState;

                if (keyboardState.W == ButtonState.Pressed)
                {
                    MoveCamera(ref forward);
                }
                if (keyboardState.S == ButtonState.Pressed)
                {
                    MoveCamera(ref back);
                }
                if (keyboardState.A == ButtonState.Pressed)
                {
                    MoveCamera(ref left);
                }
                if (keyboardState.D == ButtonState.Pressed)
                {
                    MoveCamera(ref right);
                }
            }
            var rotationMatrix = (Matrix.CreateRotationX(MathHelper.ToRadians(45.0f)) * Matrix.CreateRotationY(MathHelper.ToRadians(30.0f)));
            Vector3 transformedReference = Vector3.Transform(Vector3.Down, rotationMatrix);
            Vector3 cameraLookat = Camera.Position + transformedReference;
            var width = WaveServices.Platform.ScreenWidth / 24;
            var height = WaveServices.Platform.ScreenHeight / 24;

            //camera.Projection = Matrix.CreateOrthographic(width, height, camera.NearPlane, camera.FarPlane);
            Camera.LookAt = cameraLookat;
        }
开发者ID:123asd123A,项目名称:Samples,代码行数:34,代码来源:IsometricCameraBehavior.cs


示例2: Paddle

        public Paddle(ContentManager theContent, string theAssetName, Input theInput, PaddlePosition thePosition)
            : base(theContent, theAssetName)
        {
            SourceRectangle = new Rectangle(0, 0, 1, 1);
            Scale = new Vector2(10.0f, 100.0f);
            mColor = Color.SlateBlue;

            mPaddlePosition = thePosition;
            switch (thePosition)
            {
                case PaddlePosition.Left:
                    {
                        Boundary = new Rectangle(140, 185, 10, 833);
                        break;
                    }

                case PaddlePosition.Right:
                    {
                        Boundary = new Rectangle(1130, 185, 10, 833);
                        break;
                    }
            }

            Position = Center(Boundary);

            mInput = theInput;
        }
开发者ID:Gevil,项目名称:Projects,代码行数:27,代码来源:Paddle.cs


示例3: HandleInput

 public override void HandleInput(Input input)
 {
     if (input.IsKeyDown(Keys.Q))
     {
         move(8);
     }
 }
开发者ID:Shadowfred,项目名称:GameJam2013,代码行数:7,代码来源:MovingPlatform.cs


示例4: SimulateMouseMove

 /// <summary>
 /// Performs mouse move
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 public void SimulateMouseMove(int x, int y)
 {
     Input[] MouseEvent = new Input[1];
     MouseEvent[0].Type = 0;
     MouseEvent[0].Data = CreateMouseInput(x, y, 0, 0, MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE);
     SendInput((uint)MouseEvent.Length, MouseEvent, Marshal.SizeOf(MouseEvent[0].GetType()));
 }
开发者ID:AlexEmashev,项目名称:ZeeClient,代码行数:12,代码来源:MouseInputSimulator.cs


示例5: Handle

 void Handle(Input.Buy input)
 {
     var order = new Billing.Order();
     order.Offer = (Billing.Offer)this.Data;
     order.DateTime = DateTime.Now;
     Transaction.Commit();
 }
开发者ID:Prav962,项目名称:Billing,代码行数:7,代码来源:BuyPage.json.cs


示例6: WeatherReport

 public WeatherReport(Input userInput, MeteoData meteoData)
 {
     this.userInput = userInput;
     this.meteoData = meteoData;
     this.meteoData.addObserver(this);
     showWeatherReport();
 }
开发者ID:michaelborgmann,项目名称:wetterapp,代码行数:7,代码来源:WeatherReport.cs


示例7: OnProcessInput

        // OnProcessInput
        protected override void OnProcessInput(Input input)
        {
            if (input.ButtonJustPressed((int)E_UiButton.A)) {
                if (Menu.GetByValue() == 0) {
                    NugettaHandler connection = MyNugettaHandler.getInstance();
                    connection.FindGames((GetGamesResponse response) => {
                        List<NGame> list = response.getGames();
                        _UI.Screen.AddScreen(new JoinGame(list));
                    });
                    //_UI.Screen.AddScreen(new Screen_Popup(E_PopupType.NewGame));
                }
                else
                    if (Menu.GetByValue() == 1) {
                        _UI.Screen.SetNextScreen(null);
                    }
                    else
                        if (Menu.GetByValue() == 2) {
                            _UI.Screen.SetNextScreen(new Screen_Options());
                        }
                        else
                            if (Menu.GetByValue() == 3) {
                                _UI.Screen.AddScreen(new Screen_Popup(E_PopupType.Quit));
                            }
            }
            else
                if (input.ButtonJustPressed((int)E_UiButton.B)) {
                    SetScreenTimers(0.0f, 0.5f);

                    _G.UI.SS_FromMainMenu = true;

                    _UI.Screen.SetNextScreen(new Screen_Start());
                }
        }
开发者ID:ollesate,项目名称:TankGame,代码行数:34,代码来源:StartMenu.cs


示例8: OnInputChange

        public override void OnInputChange(Input input)
        {
            var r = (int) double.Parse(Inputs[0].Value);
            var g = (int) double.Parse(Inputs[1].Value);
            var b = (int) double.Parse(Inputs[2].Value);

            if (r < 0 || r > 255)
            {
                LogIncorrectInputValueError(Inputs[0]);
                ResetOutputs();
                return;
            }
            if (g < 0 || g > 255)
            {
                LogIncorrectInputValueError(Inputs[1]);
                ResetOutputs();
                return;
            }
            if (b < 0 || b > 255)
            {
                LogIncorrectInputValueError(Inputs[2]);
                ResetOutputs();
                return;
            }

            var result = r.ToString("X2")
                         + g.ToString("X2")
                         + b.ToString("X2");

            Outputs[0].Value = result;
        }
开发者ID:nickpirrottina,项目名称:MyNetSensors,代码行数:31,代码来源:RgbNumbersToRgbNode.cs


示例9: OnMouseLeftButtonUp

 protected override void OnMouseLeftButtonUp(Input.MouseButtonEventArgs e)
 {
     base.OnMouseLeftButtonUp(e);
     startTracking = false;
     Mouse.Capture(this, CaptureMode.None);
     
 }
开发者ID:phr34k,项目名称:System.Windows.Controls.Animation,代码行数:7,代码来源:AnimationValueLabel.cs


示例10: Initialize

        protected override void Initialize()
        {
            input = new Input();

            // State
            input.AddKeyBinding("quit", Keys.Escape);

            // Camera
            input.AddKeyBinding("zoom_out", Keys.Q);
            input.AddKeyBinding("zoom_in", Keys.E);
            input.AddKeyBinding("pan_up", Keys.W);
            input.AddKeyBinding("pan_down", Keys.S);
            input.AddKeyBinding("pan_left", Keys.A);
            input.AddKeyBinding("pan_right", Keys.D);

            // ColorMaps
            input.AddKeyBinding("toggle_coloring", Keys.Tab);
            input.AddKeyBinding("cycle_map", Keys.Tab, Modifier.Shift);
            input.AddKeyBinding("generate_random_map", Keys.Space);

            // Pen
            input.AddKeyBinding("pen_add", MouseButton.Left);
            input.AddKeyBinding("pen_sub", MouseButton.Right);
            input.AddKeyBinding("pen_size_inc", Keys.Up);
            input.AddKeyBinding("pen_size_dec", Keys.Down);
            input.AddKeyBinding("pen_pressure_inc", Keys.Right);
            input.AddKeyBinding("pen_pressure_dec", Keys.Left);

            //Map Size
            input.AddKeyBinding("map_size_inc", Keys.OemCloseBrackets);
            input.AddKeyBinding("map_size_dec", Keys.OemOpenBrackets);

            base.Initialize();
        }
开发者ID:numberoverzero,项目名称:HeatMap_2,代码行数:34,代码来源:Game.cs


示例11: Update

        public override void Update(GameTime gameTime, Input input)
        {
            time += (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            //Input handling doorgeven aan PlayingGrid
            if (input.KeyDown(Keys.Left))
                grid.MoveTetrominoLeft();
            if (input.KeyDown(Keys.Right))
                grid.MoveTetrominoRight();
            if (input.KeyDown(Keys.Up))
                grid.RotateTetromino();

            if (input.KeyDown(Keys.Down))
                updateTime /= 10;
            else if (input.KeyUp(Keys.Down))
                updateTime *= 10;

            //Als genoeg tijd verstreken is, wordt de PlayingGrid geupdated
            if (time >= updateTime)
            {
                grid.Update(input);
                time = 0;
            }

            if (input.KeyDown(Keys.Escape))
                TetrisGame.currentState = new PauseState(this);
        }
开发者ID:janbaas,项目名称:Torie,代码行数:27,代码来源:PlayingState.cs


示例12: OnProcessInput

        // OnProcessInput
        protected override void OnProcessInput(Input input)
        {
            if (LeftBar.ChildrenWidget.Count > 0)
            {
                if (input.ButtonJustPressed((int)E_UiButton.Down))
                {
                    LeftBar.IncreaseCurrent();
                }
                else if (input.ButtonJustPressed((int)E_UiButton.Up))
                {
                    LeftBar.DecreaseCurrent();
                }

            }
            if (RightBar.ChildrenWidget.Count > 0)
            {
                if (input.ButtonJustPressed((int)E_UiButton.Back))
                {
                    RightBar.DecreaseCurrent();
                }
                else if (input.ButtonJustPressed((int)E_UiButton.Enter))
                {
                    RightBar.IncreaseCurrent();
                }
            }
        }
开发者ID:tuannsofta,项目名称:kinect4bag,代码行数:27,代码来源:SideBar.cs


示例13: GetDigitalState

 protected static Int32 GetDigitalState(Input.InputFrame inputFrame, DigitalControlIdentifier identifier)
 {
     return
         inputFrame.DigitalControlStates.ContainsKey (identifier)
             ? inputFrame.DigitalControlStates [identifier]
             : 0;
 }
开发者ID:dreamsxin,项目名称:engine-1,代码行数:7,代码来源:HumanInputDeviceComponent.cs


示例14: GetButtonState

 protected static ButtonState GetButtonState(Input.InputFrame inputFrame, BinaryControlIdentifier identifier)
 {
     return
         inputFrame.BinaryControlStates.Contains (identifier)
             ? ButtonState.Pressed
             : ButtonState.Released;
 }
开发者ID:dreamsxin,项目名称:engine-1,代码行数:7,代码来源:HumanInputDeviceComponent.cs


示例15: GetAnalogState

 protected static Single GetAnalogState(Input.InputFrame inputFrame, AnalogControlIdentifier identifier)
 {
     return
         inputFrame.AnalogControlStates.ContainsKey (identifier)
             ? inputFrame.AnalogControlStates [identifier]
             : 0.0f;
 }
开发者ID:dreamsxin,项目名称:engine-1,代码行数:7,代码来源:HumanInputDeviceComponent.cs


示例16: InputsOnTheSameString_AtDifferentPositions_AreNotEqual

 public void InputsOnTheSameString_AtDifferentPositions_AreNotEqual()
 {
     var s = "Nada";
     var i1 = new Input(s, 1);
     var i2 = new Input(s, 2);
     Assert.AreNotEqual(i1, i2);
 }
开发者ID:PeteShearer,项目名称:Sprache,代码行数:7,代码来源:InputTests.cs


示例17: Update

        /// <summary>
        /// Update Method
        /// </summary>
        /// <param name="gameTime"></param>
        protected override void Update(TimeSpan gameTime)
        {
            this.input = WaveServices.Input;

            // if (this.input.KeyboardState.IsConnected)
            {
                this.keyboardState = this.input.KeyboardState;

                if (revoluteJoint != null)
                {
                    // A, D, S Keyboard Control (left, right, stop motor)
                    if (this.keyboardState.A == ButtonState.Pressed)
                    {
                        if (revoluteJoint.MotorSpeed + motorSpeed <= maxSpeed)
                        {
                            revoluteJoint.MotorSpeed += motorSpeed;
                        }
                    }
                    else if (this.keyboardState.D == ButtonState.Pressed)
                    {
                        if (revoluteJoint.MotorSpeed - motorSpeed >= -maxSpeed)
                        {
                            revoluteJoint.MotorSpeed -= motorSpeed;
                        }
                    }
                    else if (this.keyboardState.S == ButtonState.Pressed)
                    {
                        revoluteJoint.MotorSpeed = 0.0f;
                    }
                }
            }
        }
开发者ID:nagyistoce,项目名称:WaveEngine-Samples,代码行数:36,代码来源:MotorBehavior.cs


示例18: ProcessInput

        // ProcessInput
        public void ProcessInput( Input input )
        {
            for ( int i = 0; i < Widgets.Count; ++i )
            Widgets[ i ].ProcessInput( input );

            OnProcessInput( input );
        }
开发者ID:tuannsofta,项目名称:kinect4bag,代码行数:8,代码来源:Screen.cs


示例19: ByAttribute

 public ByAttribute(By by, string attributeName, string attributeValue, Func<string, string, bool> attrComparisonMethod, Input input = Input.Type, bool visibleOnly = true)
     : base(by, input, visibleOnly)
 {
     Attributes = new Dictionary<string, string>();
     Attributes.Add(attributeName, attributeValue);
     ComparisonMethod = attrComparisonMethod;
 }
开发者ID:Duduosun,项目名称:SpecFlow.Extensions,代码行数:7,代码来源:ByAttribute.cs


示例20: OnInputChange

        public override void OnInputChange(Input input)
        {
            var a = double.Parse(Inputs[0].Value);
            var b = double.Parse(Inputs[1].Value);

            Outputs[0].Value = a < b ? "1" : "0";
        }
开发者ID:nickpirrottina,项目名称:MyNetSensors,代码行数:7,代码来源:LogicCompareLowerNode.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# InputAction类代码示例发布时间:2022-05-24
下一篇:
C# InlineContentComment类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap