>if sleeping for 1000 milliseconds is a second, it seems to me
>that the Windows one is wrong
1000 msecs=1 second
But that works and it really sleeps for about a second - even on windows. So... most likely your code is to blame.
Well, in general that approach is flawed. Different machines have different speed. Each frame takes more or less time... so you actually need to determine how many time elapsed and adjust the wait time span accordingly.
If you're using 1.5, it's easy, because you can use nanoTime().
private long timeNow, timeThen, timeLate = 0, timeDelta, desiredFrameRate=75;
private void sync(long frameFraction)
long gapTo = frameFraction + timeThen;
timeNow = System.nanoTime();
}while(gapTo > timeNow+timeLate);
timeLate = timeNow-gapTo;
timeLate = 0;
timeDelta = timeNow - timeThen;
timeThen = timeNow;
You can ignore (remove) the timeDelta bit if you want to use tick based animation.
>I'm not trying to make a living out of it
There is no reason to point that out, because it doesn't make a difference
>Is there any useful online introduction to the basics of
>games writing, especially in Java?
There are tons of information out there. gamasutra.com and nehe.gamedev.net for example.
Check out kev's tuts:http://www.cokeandcode.com/index.php?page=resources