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: 328

Filed under:
|
|
|
|

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:

  1. Do I need other/ 3rd party library for KEY HOLDS?

  2. 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).

  3. 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

Related posts about c++

Related posts about opengl