Noob: CreateTimer() Help
BlitzMax Forums/BlitzMax Beginners Area/Noob: CreateTimer() Help
| ||
I just noticed this ability, can you set up a timer and have it call a Function? If so...how? Thanks for your help. |
| ||
you can do this with EVENT_TIMERTICK http://www.blitzbasic.com/Community/_search.php?bbs=BlitzMax&forum=&terms=EVENT_TIMERTICK&method=simple&case=no&results=topic&user=&submit=Search |
| ||
ahh...so you poll each loop then? I was thinking it was more like an internal thread or "interrupt" that gets called. That way your main loop was free to do it's own thing. I already have software timers based on millisecs() I guess I'll just keep doing that then. |
| ||
I was thinking it was more like an internal thread or "interrupt" that gets called. When you filter the EVENT_TIMERTICK in a hook function that should work. |
| ||
... as the hook function is called automatically once registered. |
| ||
Never used the hook function either. Will investigate this. Thanks for the help. |
| ||
Have a look at this: http://www.blitzbasic.com/codearcs/codearcs.php?code=1690 that comes may quite close... |
| ||
The dev/SVN version of blitzmax has a threading module which works really nicely, but still has a couple of issues and needs a general tidy-up. Hopefully it'll make it into a release version soon (because I want to use it!) |
| ||
Personally, I wasn't a fan of blitz event timers as the event system seems too screwy with delays and checks, so I just use a (millisecond - lastcheck) > (<insert tick count variable>) style of timers to call functions or make updates. Not entirely sure what the issues are with threads as I haven't kept up on them, but i'm using threads for a game/application archive updater with multiple download progress bars with bruceys bah.CEGUI mod and file/http streams, without any issues on my side, or the clients that have tested it. Running smooth. Although since it doesn't have to run more than a few minutes, I suppose that's not a great announcement. Time |
| ||
http://www.blitzbasic.com/codearcs/codearcs.php?code=1721 Include the Type definition Tbeat into your code. Then when you want a Timer MyTimer:Tbeat = New TBeat.Create (MilliDelay:Int, Name of Function) This will call the function named every MilliDelay |