Timer() - anything faster?
-
I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.
You want less than a millisecond? Our eyes cannot even see such speed. I do not know of anything that is faster than a timer in .NET... If your animation is not running to subtle, maybe you should look for smaller pixels or move the image by more than a dot instead of faster images. No idea how to do that though. Just saying speed might not be the problem.
It's an OO world.
-
I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.
Try System.Diagnostics.Stopwatch
David Anton Convert between VB, C#, C++, & Java www.tangiblesoftwaresolutions.com
-
I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.
Although its examples and downloads use C#, I would recommend you read Timer surprises, and how to avoid them[^]. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
You want less than a millisecond? Our eyes cannot even see such speed. I do not know of anything that is faster than a timer in .NET... If your animation is not running to subtle, maybe you should look for smaller pixels or move the image by more than a dot instead of faster images. No idea how to do that though. Just saying speed might not be the problem.
It's an OO world.
-
I'm testing the collisions with a brick with pixel accuracy. It's the only way I could get the collision working properly.
Cyclone_S wrote:
It's the only way I could get the collision working properly.
Obviously there are other ways. Here are a few ideas: 1. you don't need to draw anything to detect collisions, you could do it mathematically. That is modelling rather than animation. The model would generate the exact time and location of the collisions, animation would only be used to show the required frames. 2. even when collision detection is based on actual frames, you don't need to do it in real-time, you could calculate a number of new frames ahead of time (at the expense of more memory), and only show some of them, at the right pace. Either way, you may choose to use floating-point for extra accuracy while calculating, and turn the relevant data into integers when calculating the actual frames. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
I'm testing the collisions with a brick with pixel accuracy. It's the only way I could get the collision working properly.
Well, I can't really help there. Although I did find the QueryPerformanceTimer, which looks like it could help you. http://tomtech999.wordpress.com/2008/10/24/using-a-queryperformancetimer/[^] http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter[^] Hope that is what you're looking for :) Good luck!
It's an OO world.
-
I am animating a ball and I need something faster then what I'm getting with the form Timer() control. Is there anything faster that I can use to speed up the animation? Thanks.
Timer () only to 1 Ms fastest, write their own a Delay ().