April 19, 200521 yr 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)
April 19, 200521 yr 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
April 20, 200521 yr Oh I see!So the numbers don't relate to actual pixel deflection like in XML.Thanks Arne,
Create an account or sign in to comment