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


C# Input.KeyboardKeyEventArgs类代码示例

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


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

示例1: GameWindow_KeyDown

 private void GameWindow_KeyDown(object sender, KeyboardKeyEventArgs e)
 {
     if (Key.Escape == e.Key)
     {
         gameWindow.Exit();
     }
 }
开发者ID:danielscherzer,项目名称:Framework,代码行数:7,代码来源:Program.cs

示例2: OnKeyDown

        protected void OnKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if(e.Key == Key.Left && camera_CAM != null) {
                camera_CAM.X -= 2;
            }
            else if(e.Key == Key.Right && camera_CAM != null) {
                camera_CAM.X += 2;
            }
            else if(e.Key == Key.Up && camera_CAM != null) {
                camera_CAM.Y += 2;
            }
            else if(e.Key == Key.Down && camera_CAM != null) {
                camera_CAM.Y -= 2;
            }
            else if(e.Key == Key.Plus && camera_CAM != null) {
                camera_CAM.Z += 2;
            }
            else if(e.Key == Key.Minus && camera_CAM != null) {
                camera_CAM.Z -= 2;
            }
            //Console.WriteLine(e.Key.ToString());

            //Check player keyboardcontrols
            //player.KeyboardControls(e);
        }
开发者ID:Erlisch,项目名称:Caliginous,代码行数:25,代码来源:Game.cs

示例3: KeyToChar

        private char KeyToChar(KeyboardKeyEventArgs e)
        {
            var str = e.Key.ToString();

            if (str.Length == 1) {
                return e.Shift ? str[0] : str.ToLower()[0];
            } else if (str.StartsWith("Number") || str.StartsWith("Keypad") && str.Length == 7) {
                return str[6];
            }

            switch (e.Key) {
                case Key.BackSlash:
                    return '\\';
                case Key.BracketLeft:
                    return '(';
                case Key.BracketRight:
                    return ')';
                case Key.Comma:
                    return ',';
                case Key.Space:
                    return ' ';
            }

            return '\0';
        }
开发者ID:alexturpin,项目名称:Zombles,代码行数:25,代码来源:UITextBox.cs

示例4: KeyDownHandler

        void KeyDownHandler(object sender, KeyboardKeyEventArgs e)
        {
            switch (e.Key)
            {
                case OpenTK.Input.Key.Escape:
                    if (!CursorVisible)
                        CursorVisible = true;
                    else
                        Exit();
                    break;

                case Key.Number1: WindowState = WindowState.Normal; break;
                case Key.Number2: WindowState = WindowState.Maximized; break;
                case Key.Number3: WindowState = WindowState.Fullscreen; break;
                case Key.Number4: WindowState = WindowState.Minimized; break;

                case Key.Number5: WindowBorder = WindowBorder.Resizable; break;
                case Key.Number6: WindowBorder = WindowBorder.Fixed; break;
                case Key.Number7: WindowBorder = WindowBorder.Hidden; break;

                case Key.Left: X = X - 16; break;
                case Key.Right: X = X + 16; break;
                case Key.Up: Y = Y - 16; break;
                case Key.Down: Y = Y + 16; break;

                case Key.KeypadPlus:
                case Key.Plus: Size += new Size(16, 16); break;

                case Key.KeypadMinus:
                case Key.Minus: Size -= new Size(16, 16); break;
            }
        }
开发者ID:shahid-pk,项目名称:opentk,代码行数:32,代码来源:GameWindowStates.cs

示例5: OnKeyDown

 private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
 {
     switch (e.Key)
     {
         case Key.Space: _enableMipmapping = !_enableMipmapping; break;
     }
 }
开发者ID:olegbom,项目名称:ObjectTK,代码行数:7,代码来源:BufferLayoutTexturingExample.cs

示例6: OnKeyDown

	/// <summary>
	/// Occurs whenever a keybord key is pressed.
	/// </summary>
	protected virtual void OnKeyDown(KeyboardKeyEventArgs e)
	{
		switch(e.Key)
        {
            // Lighting
            case OpenTK.Input.Key.L:
                if (GL.IsEnabled(EnableCap.Lighting)) GL.Disable(EnableCap.Lighting);
                else GL.Enable(EnableCap.Lighting);
                break;

            // Texture
            case OpenTK.Input.Key.T:
                if (GL.IsEnabled(EnableCap.Texture2D)) GL.Disable(EnableCap.Texture2D);
                else GL.Enable(EnableCap.Texture2D);
                break;

            // Dynamic Update
            case OpenTK.Input.Key.D:
                dynamicUpdate = !dynamicUpdate;
                break;

            // Exit
            case OpenTK.Input.Key.Escape:
                Exit();
                break;
        }
    }
开发者ID:Airstriker,项目名称:VBO-OpenTK-Example,代码行数:30,代码来源:T08_VBO.cs

示例7: OnKeyDown

 public void OnKeyDown(KeyboardKeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         game.States.Push(new GameState(game));
     }
 }
开发者ID:Blezzing,项目名称:Brawlocks,代码行数:7,代码来源:MainMenuState.cs

示例8: _wind_KeyDown

 private void _wind_KeyDown(object sender, KeyboardKeyEventArgs e)
 {
     if (EventKeysDown.ContainsKey(e.Key))
     {
         EventKeysDown[e.Key].Invoke(null);
     }
 }
开发者ID:joanCalmetMarin,项目名称:DllGameMaker,代码行数:7,代码来源:KeyBoardEvents.cs

示例9: HandleKeyDown

        // Key Down
        void HandleKeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if (e.Key == Key.Escape) windowCopy.Exit();

            switch (e.Key)
            {
                case Key.W:
                    moveForward = true;
                    break;
                case Key.A:
                    moveRight = true;
                    break;
                case Key.S:
                    moveBack = true;
                    break;
                case Key.D:
                    moveLeft = true;
                    break;
                case Key.Q:
                    moveUp = true;
                    break;
                case Key.E:
                    moveDown = true;
                    break;
            }
        }
开发者ID:Aehrraid,项目名称:komorebi,代码行数:27,代码来源:InputManager.cs

示例10: OnKeyDown

 private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
 {
     // close window on escape press
     if (e.Key == Key.Escape) Close();
     // reset camera to default position and orientation on R press
     if (e.Key == Key.R) Camera.ResetToDefault();
 }
开发者ID:olegbom,项目名称:ObjectTK,代码行数:7,代码来源:ExampleWindow.cs

示例11: keyboard_KeyUp

 void keyboard_KeyUp(object sender, KeyboardKeyEventArgs e)
 {
     if (root.Focused)
     {
         this.root.OnKeyUpEvent(new KeyEventArgs(e.Key, this.GetModifierKeys()));
     }
 }
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:7,代码来源:EventSystem.cs

示例12: game_KeyUp

 static void game_KeyUp(object sender, KeyboardKeyEventArgs e)
 {
     while (keysDown.Contains(e.Key))
     {
         keysDown.Remove(e.Key);
     }
 }
开发者ID:KollaneSnake,项目名称:OpenTK_Labirint,代码行数:7,代码来源:Input.cs

示例13: GameWindow_KeyDown

 private void GameWindow_KeyDown(object sender, KeyboardKeyEventArgs e)
 {
     switch (e.Key)
     {
         case Key.Escape: gameWindow.Close(); break;
     }
 }
开发者ID:danielscherzer,项目名称:Framework,代码行数:7,代码来源:Program.cs

示例14: OnKeyUp

        protected void OnKeyUp(object sender, KeyboardKeyEventArgs e)
        {
            base.OnKeyUp(e);

            if (states.Count > 0)
                states.Peek().OnKeyUp(this, e, Keyboard, Mouse);
        }
开发者ID:Robmaister,项目名称:RPI-Game-Jam-10-27-12,代码行数:7,代码来源:EscapeGameWindow.cs

示例15: Window_KeyDown

        private static void Window_KeyDown(object sender, KeyboardKeyEventArgs e)
        {
            double coord_y = 0;
            double coord_x = 0;

            if (e.Key == Key.Up)
            {
                coord_x = 1;
                coord_x *= 1;
            }

            if (e.Key == Key.Down)
            {
                coord_x = 1;
                coord_x *= -1;
            }

            if (e.Key == Key.Right)
            {
                coord_y = 1;
                coord_y *= 1;
            }

            if (e.Key == Key.Left)
            {
                coord_y = 1;
                coord_y *= -1;
            }

            GL.Rotate(0.5, new Vector3d(coord_x, 0.0, 0.0));
            GL.Rotate(0.5, new Vector3d(0.0, coord_y, 0.0));
        }
开发者ID:oe2dlo,项目名称:GitProjects,代码行数:32,代码来源:Program.cs


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