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


C# Input类代码示例

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


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


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