Welcome! Log In Create A New Profile


Make app "wait" for "x" seconds

Posted by ToNoobIsHuman 
Make app "wait" for "x" seconds
January 03, 2009 08:10AM
My app i'm working on moves too fast for the user to see the text outputted.
I'm new to all this and am not sure how to make my app "wait" for "x" seconds, then continue. I really need this.

writing under latest libogc release and devkitpro pack.

Edited 1 time(s). Last edit at 01/03/2009 08:11AM by ToNoobIsHuman.
Re: Make app "wait" for "x" seconds
January 03, 2009 08:13AM
sleep(1000) will wait for 1000 msecs or 1 second.
Re: Make app "wait" for "x" seconds
January 03, 2009 08:24AM
Got this in output/debug:

warning: implicit declaration of function 'sleep'

Tried anyway and it just froze after the first "sleep()" called.

Any suggestions?
Re: Make app "wait" for "x" seconds
January 03, 2009 08:37AM
Tried sleep(5) and it waited 5 seconds... lol my app was working, just wanted to wait 5000 seconds based on your recommendation :P

NP prob resolved, thanks so much :)
Re: Make app "wait" for "x" seconds
January 03, 2009 08:40AM
Sorry, there's two definitions of sleep() - one is msecs, other is secs. Never used sleep() on the Wii myself. If you need small increments use usleep() or nanosleep()

Syntax for usleep is usleep(500000); - will wait 1/2 sec (this I'm sure about) ;)
Re: Make app "wait" for "x" seconds
January 03, 2009 08:54AM
If you wish to remove the warning message add in:
#include < unistd.h >
(remove the spaces between the < and >.)
Re: Make app "wait" for "x" seconds
January 03, 2009 09:07AM
You guys are awsome! Thanks for the quick reply to what must seem to be a real noob question. I want to make sure you know how much I appreciate it :)

Just so it's known. I'm working on an app that someone else has requested.

I call it "/Quit".
It's super basic - It's my first release so yea hehe.

It seeks for a disc in the drive, if one is present it ejects it. Then it shutsdown the Wii to "Red" standby mode.

Like I said, someone had requested this to be written so I figured it'd be a great one for me to "learn" with :)

Through out the steps in the app, it displays it's current actions (seek/eject/shutdown), so thats why I needed it to "sleep" since these functions complete so fast.

Thanks again and I'll make sure to place the source/release package up on wiibrew.org when I'm done.
Sorry, only registered users may post in this forum.

Click here to login