Function
gSPObjRectangleR
Draws a sprite referencing a 2D matrix
Syntax
#include <ultra64.h> /* gs2dex.h */
gSPObjRectangleR(Gfx *gdl, uObjSprite *sp)
gsSPObjRectangleR( uObjSprite *sp)
Arguments
Description
References the 2D matrix elements X, Y, BaseScaleX, and BaseScaleY, changes the screen coordinate values for drawing, and draws a non-rotating sprite. The 2D matrix is set using g*SPObjSubMatrix.
To use a number of sprites consider this example, where the sprites A, B and C are lined up horizontally as shown:
By changing X and Y in these settings, the three sprites can move together as one large sprite. However, gaps may appear between A & B and B & C, as shown below, due to an error in multiplication or other calculations.
Comment
The uObjSubMtx_t structure is shown below.
* For information about the uObjSprite structure, see g*SPObjRectangle and also refer to the "4.2.1 uObjSprite structure" in the Readme file of the latest version of the S2DEX microcode.
typedef struct {
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjSubMtx_t; /* 8 bytes */
This macro references the values of the 2D matrix X, Y, BaseScaleX, and BaseScaleY, and determines the vertex coordinates of the sprite using the following formulas:
Upper-left coordinates: (X+objX/BaseScaleX, Y+objY/BaseScaleY)
ower-right coordinates: (X+(objX+imageW/scaleW)/BaseScaleX-1,
Y+(objY+imageH/scaleH)/BaseScaleY-1)
Use g*SPObjSubMatrix to change X, Y, BaseScaleX, and BaseScaleY. When X = Y = 0 and BaseScaleX = BaseScaleY = 1.0, the result will be the same as with g*SPObjRectangle. Changing the settings of the 2D matrix elements {X, Y, BaseScaleX, and BaseScaleY} enables several sprites to be moved or scaled as a unit.
For other functions, see g*SPObjRectangle.
See Also
gSPObjMatrix, gSPObjRectangle, gSPObjSprite, and gSPObjSubMatrix
Revision History
02/01/99 Entirely revised.