Sign in to follow this  
Guest pscarratt

Still don't get it! (C Whiskey Compass)

Recommended Posts

Hi all,Still trying to work through the C examples from the SDK and I am confused by the whiskey compass....Looking at the code below you can see that val (used in the x direction callback) will return a value between 0 and 360.However when you look at the BMP used it is 651 pixels wide - so how does it relate? If it only moves 360 pixels in the X direction it cannot cover the whole width?!Also, at what position does the BMP start? I.e. in the make_moving macro we set 22,41 as the pos for the mask, will the top left of the moving image align to that? Any help would be much appreciated!!Cheers,Paul.FLOAT64 FSAPI wiskey_moving_card_x_cb( PELEMENT_MOVING_IMAGE pelement ){ FLOAT64 val = 360.0 - pelement->source_var_x.var_value.n; if( val >= 0 && val <= 360 ) return val; else return 0;}FLOAT64 FSAPI wiskey_moving_card_y_cb( PELEMENT_MOVING_IMAGE pelement ){ return 1.0;}MAKE_MOVING( wiskey_moving_card, BMP_COMPASS_SMALL_CARD, NULL, wiskey_fail, IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY, 0, 22,41, WHISKEY_COMPASS_DEGREES, wiskey_moving_card_x_cb, 0, 360, MODULE_VAR_NONE, wiskey_moving_card_y_cb, 0, 0)

Share this post


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

Have also a look at :... WHISKEY_COMPASS_DEGREES, wiskey_moving_card_x_cb, 0, 360,...it means that with return value 0 the moving card is aligned to the left of the mask image. If the return value is 360 the moving card is aligned to the right of the mask image. A value in between gives an interpolated shift. You could e.g. reverse the movement by swapping "0, 360," to "360, 0,". Because of the outer alignement, the moving card is always wider then expected, exactly the width of the mask is added (or height for vertical movement).Arne Bartels

Share this post


Link to post
Share on other sites

Oh I see!So the numbers don't relate to actual pixel deflection like in XML.Thanks Arne,

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