[CHG] Say goodbye to GRRLIB_SetOffset.

[CHG] SetMidHandle can now be turned on/off.
This commit is contained in:
Xane 2009-03-09 02:08:28 +00:00
parent bd14db7c46
commit 1a0b496d3b
2 changed files with 18 additions and 20 deletions

View file

@ -565,7 +565,7 @@ inline void GRRLIB_DrawImg(f32 xpos, f32 ypos, struct GRRLIB_texImg tex, float d
guMtxRotAxisDeg (m2, &axis, degrees); guMtxRotAxisDeg (m2, &axis, degrees);
guMtxConcat(m2, m1, m); guMtxConcat(m2, m1, m);
guMtxTransApply(m, m, xpos+width+tex.handlex+tex.offsetx+(scaleX*( -tex.handley*sin(-DegToRad(degrees)) - tex.handlex*cos(-DegToRad(degrees)) )), ypos+height+tex.handley+tex.offsety+(scaleX*( -tex.handley*cos(-DegToRad(degrees)) + tex.handlex*sin(-DegToRad(degrees)) )), 0); guMtxTransApply(m, m, xpos+width+tex.handlex-tex.offsetx+(scaleX*( -tex.handley*sin(-DegToRad(degrees)) - tex.handlex*cos(-DegToRad(degrees)) )), ypos+height+tex.handley-tex.offsety+(scaleX*( -tex.handley*cos(-DegToRad(degrees)) + tex.handlex*sin(-DegToRad(degrees)) )), 0);
guMtxConcat(GXmodelView2D, m, mv); guMtxConcat(GXmodelView2D, m, mv);
GX_LoadPosMtxImm(mv, GX_PNMTX0); GX_LoadPosMtxImm(mv, GX_PNMTX0);
@ -683,7 +683,7 @@ inline void GRRLIB_DrawTile(f32 xpos, f32 ypos, struct GRRLIB_texImg tex, float
Vector axis = (Vector) {0, 0, 1 }; Vector axis = (Vector) {0, 0, 1 };
guMtxRotAxisDeg(m2, &axis, degrees); guMtxRotAxisDeg(m2, &axis, degrees);
guMtxConcat(m2, m1, m); guMtxConcat(m2, m1, m);
guMtxTransApply(m, m, xpos+width+tex.handlex+tex.offsetx+(scaleX*( -tex.handley*sin(-DegToRad(degrees)) - tex.handlex*cos(-DegToRad(degrees)) )), ypos+height+tex.handley+tex.offsety+(scaleX*( -tex.handley*cos(-DegToRad(degrees)) + tex.handlex*sin(-DegToRad(degrees)) )), 0); guMtxTransApply(m, m, xpos+width+tex.handlex-tex.offsetx+(scaleX*( -tex.handley*sin(-DegToRad(degrees)) - tex.handlex*cos(-DegToRad(degrees)) )), ypos+height+tex.handley-tex.offsety+(scaleX*( -tex.handley*cos(-DegToRad(degrees)) + tex.handlex*sin(-DegToRad(degrees)) )), 0);
guMtxConcat(GXmodelView2D, m, mv); guMtxConcat(GXmodelView2D, m, mv);
GX_LoadPosMtxImm(mv, GX_PNMTX0); GX_LoadPosMtxImm(mv, GX_PNMTX0);
@ -821,26 +821,25 @@ void GRRLIB_SetHandle( struct GRRLIB_texImg * tex, int x, int y ) {
} }
} }
/**
* Set a texture's X and Y offset (e.g. for rotation).
* @param tex The texture to set the handle on.
* @param x The x-coordinate of the offset.
* @param y The y-coordinate of the offset.
*/
void GRRLIB_SetOffset( struct GRRLIB_texImg * tex, int x, int y ) {
tex->offsetx = x;
tex->offsety = y;
}
/** /**
* Center a texture's handles (e.g. for rotation). * Center a texture's handles (e.g. for rotation).
* @param tex The texture to center. * @param tex The texture to center.
*/ */
void GRRLIB_SetMidHandle( struct GRRLIB_texImg * tex ) { void GRRLIB_SetMidHandle( struct GRRLIB_texImg * tex, bool enabled ) {
tex->handlex = 0; if (enabled) {
tex->handley = 0; if (tex->tiledtex) {
tex->offsetx = 0; tex->offsetx = (((int)tex->tilew)/2);
tex->offsety = 0; tex->offsety = (((int)tex->tileh)/2);
} else {
tex->offsetx = (((int)tex->w)/2);
tex->offsety = (((int)tex->h)/2);
}
GRRLIB_SetHandle(tex, tex->offsetx, tex->offsety);
} else {
GRRLIB_SetHandle(tex, 0, 0);
tex->offsetx = 0;
tex->offsety = 0;
}
} }
/** /**

View file

@ -140,8 +140,7 @@ void GRRLIB_ClipDrawing( int x, int y, int width, int height );
void GRRLIB_ClipReset(); void GRRLIB_ClipReset();
void GRRLIB_SetHandle(struct GRRLIB_texImg * tex, int x, int y); void GRRLIB_SetHandle(struct GRRLIB_texImg * tex, int x, int y);
void GRRLIB_SetOffset( struct GRRLIB_texImg * tex, int x, int y ); void GRRLIB_SetMidHandle( struct GRRLIB_texImg * tex, bool enabled );
void GRRLIB_SetMidHandle(struct GRRLIB_texImg * tex);
u32 GRRLIB_GetPixelFromtexImg(int x, int y, struct GRRLIB_texImg tex); u32 GRRLIB_GetPixelFromtexImg(int x, int y, struct GRRLIB_texImg tex);
void GRRLIB_SetPixelTotexImg(int x, int y, struct GRRLIB_texImg tex, u32 color); void GRRLIB_SetPixelTotexImg(int x, int y, struct GRRLIB_texImg tex, u32 color);