Using keyboard with iOS simulator

Hi there. I’m planning on creating a gameplay video by recording the iOS simulator output on my Mac. The game is played by tapping buttons on the screen, but using the mouse to click these on the simulator is too slow to produce any kind of decent demonstration.

I’m using Keyboard.GetState() to check for key presses but they never seem to be detected, I’m not sure if the problem is at the simulator level or the code level. Has anyone managed to pick up key presses via the iOS simulator?

Thanks,
Ronny.

Are you showing the on screen keyboard but typing on your normal keyboard?

This isn’t something i’ve tried, but it works in other apps in the simulator, so I’d think it would work.
If you could make a minimal test case app and post it up on the github project we should be able to help you out :smile:

I’m not actually using the onscreen keyboard at all, I’d like to detect key press events so I can control my game character with the keyboard, instead of the touchscreen. My update method just has the following code, the Keys array is always empty:

KeyboardState keyState = Keyboard.GetState();
Keys[] keys = keyState.GetPressedKeys();

I can see why it wouldn’t work as there is nothing in the simulator that would have keyboard focus. I was hoping it would just work in the same way as calling TouchPanel.GetState() in a DrawableGameComponent.