Sign in to follow this  
Guest zip

How can I get a C gauge callback on each frame in FS?

Recommended Posts

Hi,I am writing a gauge file in C++ that can map the user aircraft location to an AI aircraft. To prevent the user aircraft to fly away between each update, I have to set the user aircraft location on each frame in FS.I have achieved this by using the PANEL_SERVICE_PRE_DRAW callback. The only problem is that the PRE_DRAW callback is only trigged when the panel window is visible.I know about the PRE_UPDATE callback, but this function is trigged about 18 times a secound and do not on each frame.So my question is: How can I make a gauge callback (or event) that can trigger on each frame in FS, even if the panel window is not visible?Thanks for any help!Regards,Arnt Helge HaalandMost Realistic AI

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Tip: lookup timers in the win32 library. Remember, your gauge is a standard Windows DLL, albeit with FS callbacks, so you do have access to the entire gamut of services the operating system provides, including, of all things, timers and the message loop. I prefer to use timers for "fixed" updates because it lets you setup time events, rather than the message loop that seems to be more in sequence.The key is to get the DLL's handle, because the win32 API will need that when you register a callback for either a hook or a timer, and you need to modify the DLLMain() call in gauges.h so you grab that information (should be the wParam) and store it in a variable.Or, you can use the standard gauge callback which will be called 18 times a second roughly, just don't setup the callback in a paint routine.Hope this helps,

Share this post


Link to post
Share on other sites

Etienne, This is a very interesting topic. I have been trying to achieve a Win32 timer, but did not have any success. When my pop up gauge would be called, the whole class wouldn't render due to the timer(SetTimer function). I was wondering if you could show me a small snipped of how you have it done,as that probably will resolve my problem. Thank you so much for your help.Tiberiu

Share this post


Link to post
Share on other sites

Hello, PRE_UPDATE is for Gauges and not for frames of game :)Timers is not good idea ( as black magic ) FS has a mechanism called as chains and many types of chains there are, of course it's undocummended. I have find some of them see code and have a nice day :)Roman.

Share this post


Link to post
Share on other sites

Roman,Thanks for posting this excellent piece of code. It will prove very useful!Doug

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this