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.

Gauge question

Featured Replies

I am wating to design a fuel selector gauge but I dont know what display variable to give it, and I dont know the functions to assign to the switch. It will have 2 positions, left tank (switch pointing to the left), and right tank (switch pointing to the right).Does anybody know how to achieve this?I am designing it with C++, not XML.Thanks,Kobie

Hey Kobie.Sounds like the easiest thing to do to animate this gauge would be to use the MAKE_ICON macros to animate the fuel selector.To control which tank is selected, use EventIDs. So for the mouse click rectangle on the left, you'd assign KEY_FUEL_SELECTOR_LEFT, and for the right, you guessed it, KEY_FUEL_SELECTOR_RIGHT.These are called with the following structure

BOOL	FSAPI	FuelLeft( PPIXPOINT relative_point, FLAGS32 mouse_flags)trigger_key_event(KEY_FUEL_SELECTOR_LEFT);

In this example, the mouse rectangle you designed over the left part of the fuel selector BMP background is called FuelLeft. Everytime you click there the fuel selector will be switched to the left side. of course you'd have to add some code to control the selector handle bitmap to actually move from left to right and vice-versa, but that should be straight forward. Let me know if you need mroe help.

Check FUEL_TANK_SELECTOR and the FUEL_SELECT enums to read, use KEY_FUEL_SELECTOR_.. to set.Arne Bartels

... about all those enums: How can I extract data from 'em? I think you are referring to the typedef enum FUEL_SELECT bla bla... etc stuff.Thanks,Etienne :-wave

Enums are just integers "with names".For fuel selector

MODULE_VAR fuel_sel={FUEL_TANK_SELECTOR};lookup_var(&fuel_sel);if(fuel_sel.var_value.n==FUEL_TANK_SELECTOR_ALL)//all tanks selected....if(fuel_sel.var_value.n==FUEL_TANK_SELECTOR_LEFT)...//left tank selectedif(fuel_sel.var_value.n==FUEL_TANK_SELECTOR_RIGHT)...//right tank selectedetc.

Yeah, that's clear, but if you look into gauges.h, there's somewhere the following (line 306):

typedef enum SURFACE_CONDITION{	SURFACE_CONDITION_NORMAL	= 0,	// default for the given SURFACE_TYPE	SURFACE_CONDITION_WET,	SURFACE_CONDITION_ICY,	SURFACE_CONDITION_SNOW,			 // this is for snow on a non-snow SURFACE_TYPE	SURFACE_CONDITION_MAX	   // this surface condition should always be last}SURFACE_CONDITION;

I don't think there's a TokenVar for it. Or will it then just be MODULE_VAR condi = {SURFACE_CONTITION};? Will that work? I gotta try it today.Etienne :-wave

I have not got it to work yet either. I used the FUEL_TANK_SELECTOR variable, and still nothing. The images wont change. I got the tanks to switch with the key events, but the two icon images that i enter wont change. I am just at wits end with it.... x(

Hey Kobie.Don't worry mate.If you don't mind, can you send me your code? I can have a look and try to get it working.The e-mail is [email protected]

Fabio,I got it to work :-)Thanks,Kobie

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.