Detecting long held keys on keyboard
Posted
by
Robinson Joaquin
on Game Development
See other posts from Game Development
or by Robinson Joaquin
Published on 2012-10-29T12:16:12Z
Indexed on
2012/10/29
17:26 UTC
Read the original article
Hit count: 359
I just want to ask if can I check for "KEY"(keyboard) that is HOLD/PRESSED for a long time, because I am to create a clone of breakout with air hockey for 2 different human players. Here's the list of my concern:
Do I need other/ 3rd party library for KEY HOLDS?
Is multi-threading needed? I don't know anything about this multi-threading stuff and I don't think about using one(I'm just a NEWBIE).
One more thing, what if the two players pressed their respective key at the same time, how can I program to avoid error or worse one player's key is prioritized first before the the key of the other. example:
Player 1 = W for UP & S for DOWN Player 2 = O for UP & L for DOWN
(example: W & L is pressed at the same time)
PS: I use GLUT for the visuals of the game.
© Game Development or respective owner