you may want to wrap it up in a class or put the timer vars in a record that you can pass to the functions to allow multiple timers.
you may want to wrap it up in a class or put the timer vars in a record that you can pass to the functions to allow multiple timers.
When the moon hits your eye like a big pizza pie - that's an extinction level impact event.
@Andru: thanks mate, that sort of information was what I was hoping for
@philbermon: I think I will go the record route, thanks for the idea!
cheers,
Paul
Games:
Seafox
Pages:
Syntax Error Software
itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
The X window system I am working on has a 3 stage timer built into the TApplication. it is a stak based timer adding timers is as easy as
the Ontimer is the event handling code and if it return's a True the event will remove itself.Code:Application.AddMsTask('OnTimer',Window,@OnTimer,10); Application.AddSecTask('OnTimer',Window,@OnTimer,13); Application.AddMinTask('OnTimer',Window,@OnTimer,22);
to test it I opened 12 windows with a rotationing object in each. it seems to work very well as long as the load can be handled. I've only tested the AddMsTask so far but I see no reason why the others shouldn't work as expected. My system is built around a very custom linked list design. that allows for managing many lists from a single object. so it made since to build the timer functions into the application rather then creating a bunch of timer objects. this way all events are processed in a single loop including all of the X events.
Turns out that Andru's right as always. Seems like his soltuion works for me on a Ubuntu 10.10 x64 Box with fpc 2.4.0 (ppcx64) if anyone is after the technicalities. Good find though.
I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.
I believe the correct unit is SysUtils as this has crossplatform support.
http://www.freepascal.org/docs-html/...ils/index.html
Bookmarks