ELEMENT_SPRITE

ELEMENT_SPRITE, like ELEMENT_MOVING_IMAGE, moves an element in X and Y directions and uses a mask to hide parts of the element. The difference is that ELEMENT_SPRITE can rotate an element around a pivot point. For ELEMENT_SPRITE, POS (position) is interpreted normally (as the upper-left corner position); OFS (offset) is the center of the sprite—the center of the texture maps to this point.

Textures used for ELEMENT_SPRITE must be 256 x 256. When the gauge is loaded, the resource_id specifies the image to use for the texture. The resource_id + 3 specifies the mask image. The mask doesn't have to be a specific size. The mask is placed on the gauge using the position member. The texture slides and rotates underneath the mask.

Element transformations occur in the following order:

  1. Rotate, based on source_var_0

  2. Scale, based on texture_scale_x and texture_scale_y

  3. Transpose, based on source_var_x and source_var_y

typedef struct ELEMENT_SPRITE

{

HEADER;

MODULE_VARsource_var_x;

PMODULE_VAR_CBsource_var_x_cb;

FLOAT64scale_x;

MODULE_VARsource_var_y;

PMODULE_VAR_CBsource_var_y_cb;

FLOAT64scale_y;

MODULE_VARsource_var_0;

PMODULE_VAR_CBsource_var_0_cb;

FLOAT64scale_0;

floattexture_scale_x;

floattexture_scale_y;

PIXPOINTreference;

PIXPOINTreference_old;

PIXPOINTo0, o1, o2, o3;

PIXPOINTos0, os1, os2, os3;

IMAGE_SETsprite_data;

PIMAGEtexture_data;

UINT32texture_handle;

IMAGE_SETlocal_mask_data;

PIMAGEmask_data;

PIMAGEsave_buffer;

} ELEMENT_SPRITE, *PELEMENT_SPRITE, **PPELEMENT_SPRITE;

ELEMENT_SPRITE uses the following members:

Member Description
HEADER Discussed in detail in the topic Using Drawing Elements.
source_var_x Token value used to calculate movement in the X direction.
source_var_x_cb Callback function used to modify the source_var_x member.
scale_x Scales the source_var_x value after its callback function is called. The source_var_x member is set to (source_var_x * scale_x). This value has no effect if equal to 1.
source_var_y Token value used to calculate the movement in the Y direction.
source_var_y_cb Callback function used to modify source_var_y.
scale_y Scales the source_var_y value after its callback function is called. The source_var_y member is set to (source_var_y * scale_y). This value has no effect if equal to 1.
source_var_0 Token value used to calculate the rotation around the pivot point.
source_var_0_cb Callback function used to modify source_var_0.
scale_0 Scales the source_var_0 value after its callback function is called. The source_var_0 member is set to (source_var_0 * scale_0). This value has no effect if equal to 1.
texture_scale_x Specifies how the texture image width is scaled when rendered.
texture_scale_y Specifies how the texture image height is scaled when rendered.
reference Point used to determine if the SPRITE_ELEMENT has changed enough to be re-rendered. This point is rotated with the drawing element. After rotation, if the X, Y values have not changed since the previous frame, the element is not redrawn. The closer this point is to the pivot point, the less likely it is the point will change with a small angle of rotation. The farther away this point is from the pivot point, the more likely it is that the point will change with a small angle of rotation. Generally, a point near the edge of the mask is a good reference point.
reference_old Used internally by the Panel system; do not use. Must be set to 0.
o0, o1, o2, o3 Used internally by the Panel system; do not use. Must be set to 0.
os0, os1, os2, os3 Used internally by the Panel system; do not use. Must be set to 0.
sprite_data Used internally by the Panel system; do not use. Must be set to 0.
texture_data Used internally by the Panel system; do not use. Must be set to 0.
texture_handle 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.