I'm making a game and want to have the player character be controlled by the keyboard, but I don't want to use key listeners if I don't have to because they call their methods when the key is pressed which I want to avoid. Is there a way to check if specific keys (e.g the w key) are being held down inline instead of having the listener run code when the key is pressed?
I want to have control over when the keys are "looked at" as opposed to keyPressed()
happening in the middle of the program doing other things. Is there anything like:
getIsKeyPressed(VK_w);
That would return a boolean value for if the key is currently held down?