Jump to content
Sign in to follow this  
Guest Kobie1244

Gauge question

Recommended Posts

Guest Kobie1244

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

Share this post


Link to post
Share on other sites
Guest Fabio Miguez

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.

Share this post


Link to post
Share on other sites
Guest bartels

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

Share this post


Link to post
Share on other sites

... 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

Share this post


Link to post
Share on other sites
Guest bartels

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Guest Kobie1244

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(

Share this post


Link to post
Share on other sites
Guest Fabio Miguez

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 fabiomiguez@hotmail.com

Share this post


Link to post
Share on other sites
Guest Kobie1244

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

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...