ELEMENT_MOVING_IMAGE, like ELEMENT_SLIDER, is used to move an image around on a gauge with two degrees of freedom. The difference is that ELEMENT_MOVING_IMAGE includes a mask, which does not move, and is used to hide parts of the image. In Flight Simulator 98, the whiskey compasses are drawn using ELEMENT_MOVING_IMAGE.
typedef struct ELEMENT_MOVING_IMAGE
{
HEADER;
MODULE_VARsource_var_x;
PMODULE_VAR_CBsource_var_x_cb;
FLOAT64min_x;
FLOAT64max_x;
PFN_FLOAT64lag_x;
MODULE_VARsource_var_y;
PMODULE_VAR_CBsource_var_y_cb;
FLOAT64min_y;
FLOAT64max_y;
PFN_FLOAT64lag_y;
FLOAT64scale_x;
FLOAT64scale_y;
FLOAT64offset_x;
FLOAT64offset_y;
PIXPOINTsave_position;
IMAGE_SETimage_data;
IMAGE_SETlocal_mask_data;
PIMAGEmask_data;
PIMAGEsave_buffer;
} ELEMENT_MOVING_IMAGE, *PELEMENT_MOVING_IMAGE, **PPELEMENT_MOVING_IMAGE;
ELEMENT_MOVING_IMAGE uses the following members:
Member | Description |
HEADER | Discussed in detail in the topic Using Drawing Elements. |
source_var_x | Token value used to calculate the slider's movement along the X axis. |
source_var_x_cb | Callback function use for source_var_x. |
min_x | Minimum value of source_var_x. |
max_x | Maximum value of source_var_x. |
lag_x | Do not use. |
source_var_y | Token value used to calculate the slider’s movement along the Y axis. |
source_var_y_cb | Callback function used for source_var_y. |
min_y | Minimum value of source_var_y. |
max_y | Maximum value of source_var_y. |
lag_y | Do not use. |
scale_x | Used internally by the Panel system; do not use. Must be set to 0. |
scale_y | Used internally by the Panel system; do not use. Must be set to 0. |
offset_x | Used internally by the Panel system; do not use. Must be set to 0. |
offset_y | Used internally by the Panel system; do not use. Must be set to 0. |
save_position | Used internally by the Panel system; do not use. Must be set to 0. |
image_data | Used internally by the Panel system; do not use. Must be set to 0. |
local_mask_data | Used internally by the Panel system; do not use. Must be set to 0. |
mask_data | Used internally by the Panel system; do not use. Must be set to 0. |
save_buffer | Used internally by the Panel system; do not use. Must be set to 0. |
When the gauge is loading, the resource_id member specifies the image to use as the moving image. The resource_id + 3 specifies the mask image.
The mask is placed on the gauge using the position member. The moving image moves in reference to where the mask is placed. The image is moved in X and Y directions based on the source_var_x and source_var_y values. Looking at source_var_x, the image is placed so the image’s and mask’s left sides are aligned when source_var_x is equal to min_x. Similarly, the image’s and mask’s right sides are aligned when source_var_x is equal to max_x. Looking at source_var_y, the image is placed so the image’s and mask’s top sides are aligned when source_var_y is equal to min_y. Similarly, the image’s and mask’s bottom sides are aligned when source_var_y is equal to max_y.