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


C# Window.KeyEventArgs类代码示例

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


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

示例1: KeyPressed

 public void KeyPressed(KeyEventArgs e)
 {
     if(ActiveWindow != null)
         ActiveWindow.KeyPressed(e);
     else
         CurrentState.KeyPressed(e);
 }
开发者ID:Tricon2-Elf,项目名称:SpaceHybridTest,代码行数:7,代码来源:WindowManager.cs

示例2: OnKeyPressed

        void OnKeyPressed(object sender, KeyEventArgs e)
        {
            var window = (Window)sender;
            if (e.Code == Keyboard.Key.Escape) window.Close();

            if (e.Code == Keyboard.Key.Num1)
            {
                Text.DisplayedString = "1: small white square";
                Render = RenderWorking;
            }

            if (e.Code == Keyboard.Key.Num2)
            {
                Text.DisplayedString = "2: RenderTexture used as background";
                Render = RenderBuggy;
            }

            if (e.Code == Keyboard.Key.Num3)
            {
                Text.DisplayedString = "3: More exaggerated example of #2";
                Render = RenderMoreBuggy;
            }

            if (e.Code == Keyboard.Key.Space)
            {
                DisplayText = !DisplayText;
            }
        }
开发者ID:nathanchere,项目名称:Spikes_SfmlRenderTexture,代码行数:28,代码来源:FboTest.cs

示例3: WindowOnKeyReleased

 private void WindowOnKeyReleased(object sender, KeyEventArgs keyEventArgs)
 {
     if (keyEventArgs.Code == Keyboard.Key.Escape)
     {
         Game.Instance.StateMachine.PushState(new GameStateMenu());
     }
 }
开发者ID:Yozer,项目名称:NanoWar,代码行数:7,代码来源:GameStateFinish.cs

示例4: KeyPress

 public override void KeyPress(KeyEventArgs keyEvent)
 {
     if(keyEvent.Code == Keyboard.Key.Return)
     {
         client.MyLobby.SetReady(true);
     }
 }
开发者ID:Austech,项目名称:HGlueSim,代码行数:7,代码来源:LobbyState.cs

示例5: OnKeyReleased

        private void OnKeyReleased(Object sender, KeyEventArgs e = null)
        {
            if (e != null && Game.KeyIsNotAllowed(e.Code))
                return;

            Parent.RemoveChild(this);
            Game.Reset();
        }
开发者ID:Torrunt,项目名称:SingleSwitchGame,代码行数:8,代码来源:GameOverGUI.cs

示例6: OnKeyPressed

        private void OnKeyPressed(object sender, KeyEventArgs e)
        {
            SystemMessage curMessage;
            curMessage = GameStates.Peek().HandleKeyInput((Window)sender, e); //delegate the key handling to our current state

            HandleSystemMessage(curMessage);

        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:8,代码来源:Game.cs

示例7: HandleKeyInput

        override public SystemMessage HandleKeyInput(Window window, KeyEventArgs e)
        {
            if (e.Code == Keyboard.Key.Escape)
            {
                return new PopStateMessage(this);
            }

            return null;
        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:9,代码来源:EasyModeState.cs

示例8: KeyUp

 public void KeyUp(KeyEventArgs key)
 {
     foreach (Element ele in Elements)
     {
         if (ele != null)
             ele.KeyUp(key);
     }
     OnKeyUp(key);
 }
开发者ID:Tricon2-Elf,项目名称:DystopiaRPG,代码行数:9,代码来源:Screen.cs

示例9: OnKeyPressed

        private static void OnKeyPressed(object sender, KeyEventArgs e)
        {
            if (!KeysPressed.Contains(e.Code))
            {
                KeysPressed.Add(e.Code);
            }

            State.CurrentScreen.KeyPressed(sender, e);
        }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:9,代码来源:InputHandler.cs

示例10: Move

 public static void Move(Object sender, KeyEventArgs e)
 {
     switch (e.Code)
     {
         case Keyboard.Key.W: if (!isColliding(1)) { y = y - Speed;} break;
         case Keyboard.Key.S: if (!isColliding(2)) { y = y + Speed;} break;
         case Keyboard.Key.A: if (!isColliding(3)) { x = x - Speed;} break;
         case Keyboard.Key.D: if (!isColliding(4)) { x = x + Speed;} break;
     }
 }
开发者ID:robodylan,项目名称:Simple_Platformer_Engine,代码行数:10,代码来源:Player.cs

示例11: KeyDown

        public override bool KeyDown(KeyEventArgs e)
        {
            foreach (var curr in _tabs)
            {
                if (curr.Key.KeyDown(e)) return true;

                if (_activeTab != null)
                    if (_activeTab.KeyDown(e)) return true;
            }
            return base.KeyDown(e);
        }
开发者ID:Tri125,项目名称:space-station-14,代码行数:11,代码来源:TabbedMenu.cs

示例12: KeyReleased

 public override void KeyReleased(KeyEventArgs e)
 {
     if(e.Code == Keyboard.Key.W)
         CamMove.Y = 0;
     if(e.Code == Keyboard.Key.S)
         CamMove.Y = 0;
     if(e.Code == Keyboard.Key.A)
         CamMove.X = 0;
     if(e.Code == Keyboard.Key.D)
         CamMove.X = 0;
 }
开发者ID:Tricon2-Elf,项目名称:SpaceHybridTest,代码行数:11,代码来源:IngameShipState.cs

示例13: Window_KeyPressed

 private void Window_KeyPressed(object sender, KeyEventArgs e)
 {
     switch (e.Code)
     {
         case Keyboard.Key.Space:
             LoadGame();
             break;
         case Keyboard.Key.Escape:
             this.Game.Window.Close();
             break;
     }
 }
开发者ID:sraboy,项目名称:CityBuilderSharp,代码行数:12,代码来源:GameStateStart.cs

示例14: HandleKeyPressed

 public override void HandleKeyPressed(KeyEventArgs i)
 {
     switch (i.Code)
     {
         case Keyboard.Key.Escape:
             Program.Window.SetView(Program.Window.DefaultView);
             Program.StateManager.LeaveCurrentState();
             break;
         default:
             break;
     }
 }
开发者ID:Blezzing,项目名称:Orbs,代码行数:12,代码来源:ExploringState.cs

示例15: OnKeyPressed

        public static void OnKeyPressed(object sender, KeyEventArgs e)
        {
            Console.WriteLine("Key pressed: " + e.Code);

            switch (e.Code)
            {
                // Movement.
                case SFML.Window.Keyboard.Key.A:
                case SFML.Window.Keyboard.Key.Left:
                    {
                        // Move character left.
                        Character.getCharacter(0).position[0] -= 25;

                        break;
                    }
                case SFML.Window.Keyboard.Key.D:
                case SFML.Window.Keyboard.Key.Right:
                    {
                        // Move character right.
                        Character.getCharacter(0).position[0] += 25;

                        break;
                    }
                case SFML.Window.Keyboard.Key.W:
                case SFML.Window.Keyboard.Key.Up:
                    {
                        // Move character up / jump.

                        break;
                    }
                case SFML.Window.Keyboard.Key.S:
                case SFML.Window.Keyboard.Key.Down:
                    {
                        // Move character down / crouch.

                        break;
                    }

                // Game function.
                case SFML.Window.Keyboard.Key.Escape:
                    {
                        Drawing.window.Close();
                        Console.Title = "Asialaide (ended)";

                        break;
                    }

                default:

                    break;
            }
        }
开发者ID:vladivanovic,项目名称:wakarimasen,代码行数:52,代码来源:Input.cs


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