开发者

TFPTimer not 'Ticking'

I'm writing a game which I've attempted to separate between the interface, and the simulator (both of which run with separate timing circuits - with the theory being animations will sync, and simulation can run only 10 times a second... or something)

I'm having issues with my TFPTimer. Its initialised with the Games constructor like so:开发者_运维知识库

//Create the game timer
InternalTimer := TFPTimer.Create(nil);
//Set the OnTick callback
InternalTimer.OnTimer := @OnTick;
//Set the timer interval
InternalTimer.Interval := DEFAULT_INTERNAL_TIMER; // =10
//Start the timer
InternalTimer.StartTimer;

The problem is OnTick never seems to be called. I've got a seperate loop running under the client with an SDL_Delay in it. Do I need to eventise TFPTimer somehow? Should I give it its own thread (or does it already have one?) Any ideas on making my timer work?

Thanks

Lachlan


Events come from the main event loop. If your program is not eventdriven in the Delphi/Lazarus sense it will probably not work.

Try an application.processmessages inbetween sleeps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜