How to sleep() for less than a second
July 09, 2010 10:29PM
I'm pretty new to homebrew Wii development, but I do have plenty of prior experience using C. For the moment I'm just playing around and getting a feel for how things work, trying out basic animations by drawing multiple frames (JPEGs) to screen at a desired rate. But I am having trouble with the sleep() function, where I cannot create a delay between drawing the images less than a second without basically eliminating calling the function. using sleep(.5) or sleep(1/4) gives me the same results as not calling it at all.

Any help would be appreciated.
Re: How to sleep() for less than a second
July 09, 2010 10:45PM
iirc there's usleep() in which the parameter is the time to pause in microseconds



Edited 1 time(s). Last edit at 07/09/2010 10:45PM by Arikado.
Re: How to sleep() for less than a second
July 09, 2010 10:56PM
Yeah, I just found that, too. It doesn't seem to work, either. :(. The same effect as if I commented calls to it out.
Re: How to sleep() for less than a second
July 09, 2010 11:05PM
Perhaps because you're using parameters so small you don't realize it's actually in effect?
Re: How to sleep() for less than a second
July 09, 2010 11:08PM
Is 4000 too small for usleep()?
Re: How to sleep() for less than a second
July 09, 2010 11:22PM
I think it's a bad idea to use sleep for animation, you should just skip a bunch a frame. Normally the Wii goes at 60 FPS.

When you sleep every thing will stop, including the controller.
Re: How to sleep() for less than a second
July 09, 2010 11:27PM
Yeah you can just synchronize it all using VIDEO_WaitVSync()
Re: How to sleep() for less than a second
July 09, 2010 11:28PM
Oh. I see. In that case, what are the techniques used already in homebrew apps for animations that I should be looking at?
Re: How to sleep() for less than a second
July 09, 2010 11:31PM
A lot of homebrew are open source. Don't hesitate to look at their code. Here is the list: [wiibrew.org]
Re: How to sleep() for less than a second
July 11, 2010 10:56PM
Quote
Crayon
Normally the Wii goes at 60 FPS.
On PAL it's 50 FPS.

On GuitarsOnFire I did the strangest thing, I sync animations to the audio. But most of the time using frame counters is good enough, but it will run a bit faster on PAL then on NTSC.
Re: How to sleep() for less than a second
August 14, 2010 06:39PM
Quote
Crayon
Normally the Wii goes at 60 FPS.

Well, normally the Wii doesn't have a framerate limit at all. This is the case when VIDEO_WaitVSync() isn't used.
Sorry, only registered users may post in this forum.

Click here to login