CIwSVec2 Scythe::getRotatedCoords(CIwSVec2 pos)
{
   IW_CALLSTACK("Scythe::getRotatedCoords");

   // Transform matrix by rotation matrix and find what the suppplied position would 
   // be in new post rotation coordinate system
   Iw2DSetTransformMatrix(mRot); 
   CIwMat2D transformationMatrix = Iw2DGetTransformMatrix();
   CIwVec2 transformedPosition = transformationMatrix.TransformVec(pos); 
   Iw2DSetTransformMatrix(CIwMat2D::g_Identity); 

   return CIwSVec2(transformedPosition);
}
Example #2
0
void myIwGxDrawStar(int x, int y, CIwSVec2 texpos, int iscale, iwangle rotval, int alphaf)
{
    CIwMat2D transformMatrix;
    int i;
    //
    if (ssend_vertices + 4 > (MX_VERTICES))
    {
        myIwGxDoneBonus();
        ssend_vertices = 0;
    }
    transformMatrix = CIwMat2D::g_Identity;
    transformMatrix.SetRot(rotval, CIwVec2(x, y));
    //
    // 0 = top-left
    // 1 = bottom-left
    // 2 = bottom-right
    // 3 = top-right
    //
    svertices[ssend_vertices + 0].x = x - iscale;
    svertices[ssend_vertices + 0].y = y - iscale;
    svertices[ssend_vertices + 1].x = x - iscale;
    svertices[ssend_vertices + 1].y = y + iscale;
    svertices[ssend_vertices + 2].x = x + iscale;
    svertices[ssend_vertices + 2].y = y + iscale;
    svertices[ssend_vertices + 3].x = x + iscale;
    svertices[ssend_vertices + 3].y = y - iscale;
    //
    suvdata[ssend_vertices + 0].x = (texpos.x) << 3;
    suvdata[ssend_vertices + 0].y = (texpos.y) << 3;
    suvdata[ssend_vertices + 1].x = (texpos.x) << 3;
    suvdata[ssend_vertices + 1].y = (texpos.y + 32) << 3;
    suvdata[ssend_vertices + 2].x = (texpos.x + 32) << 3;
    suvdata[ssend_vertices + 2].y = (texpos.y + 32) << 3;
    suvdata[ssend_vertices + 3].x = (texpos.x + 32) << 3;
    suvdata[ssend_vertices + 3].y = (texpos.y) << 3;
    //
    scolors[ssend_vertices + 0].Set(0xFF, 0xFF, 0xFF, (uint8)(alphaf));
    scolors[ssend_vertices + 1].Set(0xFF, 0xFF, 0xFF, (uint8)(alphaf));
    scolors[ssend_vertices + 2].Set(0xFF, 0xFF, 0xFF, (uint8)(alphaf));
    scolors[ssend_vertices + 3].Set(0xFF, 0xFF, 0xFF, (uint8)(alphaf));
    //
    for (i = 0; i < 4; i++)
        svertices[ssend_vertices + i] = transformMatrix.TransformVec(svertices[ssend_vertices + i]);
    ssend_vertices += 4;
    //
}