broken timers
BlitzMax Forums/BlitzMax Beginners Area/broken timers
| ||
This is probably a really silly question but... In both of my programs, the timers have stopped working. In a method inside a type that gets activated when I click the mouse, I have - local StartTimer:ttimer = createtimer(1) GlobalTimer = createtimer(1) debug GlobalTimer is defined as a global object in my main file. When the debug hits, both timers are null, how is that possible? Since this seems to have happened in both my programs, is there anything out there to null timers when they are created? |
| ||
if you are using Windows then you can create max 16 timers.SuperStrict Local timer:TTimer[30] For Local i:Int = 0 To 29 timer[i] = CreateTimer(1) Next DebugStop |
| ||
I made this mistake early-on with Blitzmax. Now I only ever use a single, 10Hz timer, for two reasons. 1. There is rarely any need to ever use more than one timer - you can use it for all timing calculations. 2. I also use the timer for timing effect triggers and such whereas I used to time with Millisecs(). The biggest advantage of a 10Hz timer is that it won't start to return negative values for months, whereas Millisecs() will wrap around in about 25 days. Also, I can reset the timer ticks to zero any time its convenient (usually between levels, or whatever). |
| ||
Good to know, I have to re-evaluate how I am using timers! |