Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to figure it out how to check if keyboard key was released. I tried messing around with InputMultiplexer, InputProcessor, etc. Nothing helped. Not enough documentation from lib developers (at least for me).

Anyone had similar problem? Can someone help me?

With InputProcessor I can check if single key was pressed. But what if I want to check multiple keys?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

There are two ways I can think of to accomplish this.

  1. In the InputProcessor keyPressed method you could save the key state in a map. You'll have to use the keyReleased method to set the key state to released. This way you can just check the map to make sure the right keys are pressed.

  2. Inside your update/render method call Gdx.input.isKeyPressed(Input.Keys.Key) to see if a key is pressed. This way you are polling input every frame to check for the key combination.

I personally would use method 2, but pick whatever will suit your app best. I might be able to expand on my answer more tomorrow when I'm on my Desktop. Hopefully for now this will get you going in the right direction.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.