Sorry, I should have specified that the code snippet was Java. Still, he could have used Thread.sleep(), System.currentTimeMillis(), javax.swing.Timer, or something else that didn't involve creating a new Date object every loop iteration. Also, in the same example he puts an entire animation in the AWT frame's paint() method.
I
iconoclast
@iconoclast
0
Reputation
2
Posts
20
Profile views
0
Followers
0
Following
Best posts made by iconoclast
This user hasn't posted anything yet.
Latest posts made by iconoclast
-
RE: Introduction to Computer Graphics by Frank Klawonn
-
Introduction to Computer Graphics by Frank Klawonn
Some of the code examples that come with this textbook were so awful that I snapped and decided I had to share them. Perhaps I'm overreacting, but you can be the judge. Also, apparently the text was written originally in German, because while reading it you'll encounter untranslated phrases. Anyway, here's the author's wait method:
public void sustain(long t) { long finish = (new Date()).getTime() + t; while( (new Date()).getTime() < finish ){} }