Re: Graphics Problem
- Posted by "Cuny, David" <ATB.DCUNY at HW1.CAHWNET.GOV> Mar 10, 1997
- 751 views
re: moving at a constant speed. Once you establish the speed that you want the graphical object to move across the screen, do something like the following: loop forever -- get draw time x = current ticks -- draw the object draw the object -- calculate the next draw time x = x + ticks until redraw -- wait until next draw time loop while current ticks < x end loop end loop By getting the tick rate before you draw the object, you do not add the time that it took to draw to the redraw time. If the machine is really slow (like mine), the wait time will have expires by the time it gets to the wait loop, and it will never pause. According to the documentation, can get set tick_rate() to fairly high granularity (more than the standard 18.2 ticks per second), so you should be able to time the redraw with good accuracy. -- David Cuny