Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ya2d_drawRotateTexture(ya2d_Texture *texp, int x, int y, float angle)
- {
- if(!texp->data) return;
- sceGuEnable(GU_TEXTURE_2D);
- sceGumMatrixMode(GU_TEXTURE);
- sceGumPushMatrix();
- sceGumLoadIdentity();
- ScePspFVector3 trans = (ScePspFVector3){(float)x, (float)y, 0.0f};
- sceGumTranslate(&trans);
- sceGumUpdateMatrix();
- if(texp->hasAlpha)
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
- else
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
- sceGuTexImage(0, texp->textureWidth, texp->textureHeight, texp->textureWidth, texp->data);
- ya2d_TextureVertex *vertices = (ya2d_TextureVertex *)sceGuGetMemory(4 * sizeof(ya2d_TextureVertex));
- vertices[0] = (ya2d_TextureVertex){0, 0, 0, 0};
- vertices[1] = (ya2d_TextureVertex){texp->textureWidth, 0, texp->textureWidth, 0};
- vertices[2] = (ya2d_TextureVertex){0, texp->textureHeight, 0, texp->textureHeight};
- vertices[3] = (ya2d_TextureVertex){texp->textureWidth, texp->textureHeight, texp->textureWidth, texp->textureHeight};
- sceGumDrawArray(GU_TRIANGLE_STRIP, GU_TEXTURE_16BIT|GU_VERTEX_16BIT|GU_TRANSFORM_2D, 4, 0, vertices);
- sceKernelDcacheWritebackRange(vertices, 4 * sizeof(ya2d_TextureVertex));
- sceGumPopMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement