Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

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,

  • 10 months later...
  • Commercial Member

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

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.

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

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.