Original Post
Okay, it's probably best if I explain what I'm trying to do that I can't exactly understand how to implement.
I'm trying to make a menu screen where a cursor can move up and down and select things.
I want to make the cursor, when either down or up is first pressed, to move one space up(the moving is not the issues it's the timing)or down ...
BUT I want it to move a space, stop for about one second, then keep moving as the key is held down. I DON'T want it to just move upon key pressing and holding because
the cursor will just fly up and down. Without a timer of some kind it can't move spaces and give a chance to remain in a space long enough or maneuver accurately and in a not so fast time.
Sort of like in Final Fantasy(if anyone here has played those games). So ... I don't really know how to implement a timer to accurately do this. I'm using SDL because that's the only graphics API I can actually use, install and understand so far(and with C++).
Everything else is fine, I just need, for the cursor in the menu screen, to move one space, wait about a second, then keep moving through the following spaces available in a faster speed as the key is held. Every time it's released and pressed again this should happen, the waiting, key press.
Should I make a function with timer controls/data and pass the data from other functions, make a global timer container, etc.?
I don't really know and I've never really worked with "timers" like this to understand how it works fully, how to implement it, what most mean by "timer," etc.
But I can handle everything else at this point as far as a menu screen goes. I just need help with the whole "timer" bit.
I'm trying to make a menu screen where a cursor can move up and down and select things.
I want to make the cursor, when either down or up is first pressed, to move one space up(the moving is not the issues it's the timing)or down ...
BUT I want it to move a space, stop for about one second, then keep moving as the key is held down. I DON'T want it to just move upon key pressing and holding because
the cursor will just fly up and down. Without a timer of some kind it can't move spaces and give a chance to remain in a space long enough or maneuver accurately and in a not so fast time.
Sort of like in Final Fantasy(if anyone here has played those games). So ... I don't really know how to implement a timer to accurately do this. I'm using SDL because that's the only graphics API I can actually use, install and understand so far(and with C++).
Everything else is fine, I just need, for the cursor in the menu screen, to move one space, wait about a second, then keep moving through the following spaces available in a faster speed as the key is held. Every time it's released and pressed again this should happen, the waiting, key press.
Should I make a function with timer controls/data and pass the data from other functions, make a global timer container, etc.?
I don't really know and I've never really worked with "timers" like this to understand how it works fully, how to implement it, what most mean by "timer," etc.
But I can handle everything else at this point as far as a menu screen goes. I just need help with the whole "timer" bit.