I need help getting usleep to work with devkitARM. I include unistd.h, but I get the error
"undefined reference to 'usleep'". Are there any other functions that perform a similar
function?
usleep
-
- Site Admin
- Posts: 1988
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: usleep
That really depends on what you want to use usleep for.
devkitARM is a bare metal toolchain with no threading so there are very few situations where usleep makes sense. Which platform are you writing code for and what do you need the delay for?
devkitARM is a bare metal toolchain with no threading so there are very few situations where usleep makes sense. Which platform are you writing code for and what do you need the delay for?
-
- Posts: 7
- Joined: Mon Oct 06, 2008 4:42 pm
Re: usleep
I am writing code for the NDS. I just need a simple function to slow down the update of my
sprite, otherwise it moves too fast. Currently I am using an extra swiWaitForVBlank before I
update my sprite to get the desired effect.
sprite, otherwise it moves too fast. Currently I am using an extra swiWaitForVBlank before I
update my sprite to get the desired effect.
Re: usleep
On a Game Boy Colour game (years ago) I used fractional positions. The sprite structure then stored the speed in pixel-per-frame, and by using a value lower than one I could make it move slower.
Obviously I didn't have floating point, but I wrote everything with 16.8 bit fixed point. So when updating the sprites I just used the upper 16 bits, and when updating positions I handled the overflow from the 8 bit fraction to the 16 bit integer.
Obviously I didn't have floating point, but I wrote everything with 16.8 bit fixed point. So when updating the sprites I just used the upper 16 bits, and when updating positions I handled the overflow from the 8 bit fraction to the 16 bit integer.
Who is online
Users browsing this forum: No registered users and 2 guests