0

I'm a beginner c++ programmer. I use Win XP and CodeBlocks. I'm trying to make a pong game, I already have the controls programmed, but I need a method to do the following: Check for user input, if they don't input for x milliseconds, then continue with the loop so the ball's path can be updated. Or something that could check input and move the ball at the same time. Any Suggestions? Thank you!

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by katmai539
0

Is this still a console program (the answer is in my reply to one of your other threads), or have you moved onto a GUI program?

GUI's are typically event driven, so you don't read the keys as such, but you do get key events as part of the normal flow of events.

0

Why not 'just check' for key presses, if there's none just update the ball and not the pads. add a delay at the end of every loop to ensure your program won't run way too fast ;)

the loop's like this:

do
check for keypresses
if true update pads
update ball
add delay x milliseconds
loop

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.