root/src/AIDemos/Screens/Demos/DemoGameScreen.cs
| 23 | 24 | ||
|---|---|---|---|
96 | } | 96 | } |
97 | public override void HandleInput(InputState input) | 97 | public override void HandleInput(InputState input) |
98 | { | 98 | { |
99 | int playerIndex = (int)ControllingPlayer.Value; | ||
100 | GamePadState gamePadState = input.CurrentGamePadStates[playerIndex]; | ||
101 | |||
99 | 102 | ||
100 | PlayerIndex index; | 103 | PlayerIndex index; |
101 | if (input.IsNewKeyPress(Keys.PageDown, null, out index)) | 104 | if (input.IsNewKeyPress(Keys.PageDown, null, out index)) |
... | ... | ||
110 | { | 113 | { |
111 | primitiveBatch.Zoom = 1f; | 114 | primitiveBatch.Zoom = 1f; |
112 | } | 115 | } |
116 | |||
117 | bool gamePadDisconnected = !gamePadState.IsConnected && | ||
118 | input.GamePadWasConnected[playerIndex]; | ||
119 | |||
120 | if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected) | ||
121 | { | ||
122 | ScreenManager.AddScreen(new AIDemosPauseMenuScreen(), ControllingPlayer); | ||
123 | } | ||
113 | base.HandleInput(input); | 124 | base.HandleInput(input); |
114 | } | 125 | } |
115 | } | 126 | } |
Download diff