Click here to Skip to main content
15,915,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: question about Timer Tick event Pin
Subby Dev25-Aug-06 14:39
Subby Dev25-Aug-06 14:39 
GeneralRe: question about Timer Tick event [modified] Pin
likefood25-Aug-06 14:48
likefood25-Aug-06 14:48 
AnswerIt is probably hardware specific Pin
Ennis Ray Lynch, Jr.25-Aug-06 17:29
Ennis Ray Lynch, Jr.25-Aug-06 17:29 
GeneralRe: It is probably hardware specific Pin
likefood25-Aug-06 17:47
likefood25-Aug-06 17:47 
AnswerRe: question about Timer Tick event Pin
Robert Rohde25-Aug-06 21:30
Robert Rohde25-Aug-06 21:30 
GeneralRe: question about Timer Tick event Pin
likefood26-Aug-06 13:31
likefood26-Aug-06 13:31 
AnswerRe: question about Timer Tick event Pin
Mike Dimmick26-Aug-06 2:34
Mike Dimmick26-Aug-06 2:34 
GeneralRe: question about Timer Tick event Pin
likefood26-Aug-06 13:47
likefood26-Aug-06 13:47 
<sincer>Thank you for the interesting insight!</sincere>

You bring up an interesting point. However, this program (a simple game) depends on the user seeing what's being painted so they can react properly. Thus, I prefer that painting have a slightly higher priority than the processing between painting.

Now that I've had time to sit on my code over the past day or two, I've realized that it's alright if the System.Windows.Forms.Timer skips a tick (if the timer is running faster than the code), because of the way I'm tracking movement. There are entities that move on the screen so-many pixels per second, and if a timer tick is skipped, it's made up in the next tick (by how I'm passing info around), so on each repaint the entities have moved the proper amount of distance.

Really, to be honest, the whole reason I wanted it to run as fast as possible is that I want it to repaint as fast as possible, so that the motion will appear as smooth as possible. I just didn't want choppy motion.

On a side note, I was going to ask what you mean by the "system timer" having a resolution of "15ms"? Is that milliseconds or microseconds? I ask because DateTime.Now.Ticks tells you a value down to the nearest 100 nanoseconds, which is a lot more accurate than "15ms," no matter what you're signifying with that 'm'. I added some code the other day that uses DateTime.Now.Ticks to measure how accurate System.Windows.Forms.Timer is running in my program. I do admit that System.Windows.Forms.Timer is not very accurate (the worst I saw was a disparity of .7 milliseconds), but it's good enough for what I need.

My original question was for a way to make the program tell me when the System.Windows.Forms.Timer.Interval was too small, and I made DateTime.Now.Ticks tell me that (by measuring how long a tick took compared with how long it should have taken).

I appreciate all the help, everyone! I'll just keep tweaking what I have. After all, I still have some stupid trig to get straight (things keep going in weird directions).

-Daniel
Typing too fast fro my owngood

GeneralRe: question about Timer Tick event Pin
Mike Dimmick26-Aug-06 14:32
Mike Dimmick26-Aug-06 14:32 
GeneralRe: question about Timer Tick event [modified] Pin
Mike Dimmick27-Aug-06 11:00
Mike Dimmick27-Aug-06 11:00 
GeneralRe: question about Timer Tick event Pin
likefood27-Aug-06 12:50
likefood27-Aug-06 12:50 
QuestionDateTime format Pin
kani9825-Aug-06 11:55
kani9825-Aug-06 11:55 
AnswerRe: DateTime format Pin
Ravi Bhavnani25-Aug-06 12:18
professionalRavi Bhavnani25-Aug-06 12:18 
AnswerRe: DateTime format Pin
drdavef25-Aug-06 12:29
drdavef25-Aug-06 12:29 
AnswerRe: DateTime format Pin
AnshShar25-Aug-06 12:43
AnshShar25-Aug-06 12:43 
AnswerRe: DateTime format Pin
Scott Dorman1-Sep-06 13:29
professionalScott Dorman1-Sep-06 13:29 
Questioncan someone help plz: threading the PingReply Pin
Jassim Rahma25-Aug-06 8:30
Jassim Rahma25-Aug-06 8:30 
AnswerRe: can someone help plz: threading the PingReply Pin
Not Active25-Aug-06 8:43
mentorNot Active25-Aug-06 8:43 
QuestionC# ::: receive FAX Pin
Yetinger25-Aug-06 8:21
Yetinger25-Aug-06 8:21 
AnswerRe: C# ::: receive FAX Pin
Nader Elshehabi25-Aug-06 10:29
Nader Elshehabi25-Aug-06 10:29 
GeneralRe: C# ::: receive FAX Pin
Yetinger25-Aug-06 22:29
Yetinger25-Aug-06 22:29 
AnswerRe: C# ::: receive FAX Pin
Nader Elshehabi26-Aug-06 0:59
Nader Elshehabi26-Aug-06 0:59 
AnswerRe: C# ::: receive FAX Pin
Yetinger27-Aug-06 5:28
Yetinger27-Aug-06 5:28 
QuestionCrystal Reports and Windows Applications Pin
ebonaba25-Aug-06 7:59
ebonaba25-Aug-06 7:59 
QuestionPrinting to an Okidata printer Pin
tigerButterfly25-Aug-06 7:52
tigerButterfly25-Aug-06 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.