Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - LibGDX - What is the difference between isKeyPressed and isKeyJustPressed?

Tags:

java

libgdx

What is the difference between isKeyPressed and isKeyJustPressed?!

I searched the docs. for the difference and just found:

isKeyPressed: Returns whether the key is pressed.

isKeyJustPressed: Returns whether the key has just been pressed.

Anybody knows something that explains better?!

like image 617
Android Admirer Avatar asked Dec 05 '16 17:12

Android Admirer


1 Answers

isKeyPressed detects whether the key is currently pressed.

isKeyJustPressed detects whether the key was pressed and released the last frame.

like image 113
Lestat Avatar answered Oct 19 '22 18:10

Lestat