Jump to content
  • Advertisement
Sign in to follow this  
Kenny77

[SDL] Delaying Mouse Input

This topic is 3747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to get the input to delay after my game intro screen (typical "click to continue..." sort of thing), but I get inconsistent delays using SDL_Delay(100). What's happening is I click at the continue screen and if the mouse is above the button, it'll go to that option. But I'm trying to get it so it delays then displays the menu. This options seems be the best, ít's just not working all the time. Or, I might go with a timed delay inside of the main menu, but I don't want the menu to be drawn and not able to accept input (example): if (timeSinceStateInitialized + 100MSInputDelay > currentTicks) { // Skip the input component of the FSM } And last option is to check if the mouse is clicked and released over the button, I'm just not sure how to do that. Thoughts or comments?

Share this post


Link to post
Share on other sites
Advertisement
Yeah, SDL_Delay is pretty much the wrong thing to use here - it pauses the whole app. Could you be more specific about 'delay'? Delay usually means to put something off until the future, whereas here it's not clear whether you actually just want to disallow mouse input for a while, or buffer it up until the time has elapsed, or just show an intermediate screen, or what.

Share this post


Link to post
Share on other sites
Do you want to not do anything with the input until your intro screen is done? I would setup a flag like PlayingIntro. While that flag is set to true, don't do anything with the input.

EDIT: Re-read your post. I would just use a timer, and when the timer reaches the certain amount of time, allow input using the same flag system as above.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!