ENIGMA Forums
Contributing to ENIGMA => Function Peer Review => Topic started by: TheExDeus on September 09, 2010, 02:11:31 pm
-
If I understand the point of this section correctly, then we can add function code here? If so, then I will start by implementing simple, but missing additions.
edit: Removed unneeded glColor4f function.
Function: draw_sprite_stretched_ext(int sprite,int subimg,double x,double y,double w,double h,int color,double alpha)
GSSprite.h:
int draw_sprite_stretched_ext(int sprite,int subimg,double x,double y,double w,double h,int color,double alpha);
GSSprite.cpp:
int draw_sprite_stretched_ext(int spr,int subimg,double x,double y,double w,double h, int blend, double alpha)
{
enigma::sprite *spr2d=enigma::spritestructarray[spr];
if (!spr2d)
return -1;
glPushAttrib(GL_CURRENT_BIT);
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve!=spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve=spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glBegin(GL_QUADS);
glColor4ub(__GETR(blend),__GETG(blend),__GETB(blend),char(alpha*255)); //Implement "blend" parameter
glTexCoord2f(spr2d->texbordx,0);
glVertex2f(x-spr2d->xoffset,y-spr2d->yoffset);
glTexCoord2f(0,0);
glVertex2f(x+w-spr2d->xoffset,y-spr2d->yoffset);
glTexCoord2f(0,spr2d->texbordy);
glVertex2f(x+w-spr2d->xoffset,y+h-spr2d->yoffset);
glTexCoord2f(spr2d->texbordx,spr2d->texbordy);
glVertex2f(x-spr2d->xoffset,y+h-spr2d->yoffset);
glEnd();
glPopAttrib();
return 0;
}
If this is how should these topics look like, then I will do others too.
-
That's just how it looks.
Seems to be like the others, so if you've tested that and it works, I'll add it now.
-
Yes, it works. I will make others now.
-
Integrated for next revision.