Pages: [1]
  Print  
Author Topic: GML: draw_sprite_stretched_ext  (Read 1047 times)
Offline (Unknown gender) TheExDeus
Posted on: September 09, 2010, 02:11:31 PM

Developer
Joined: Apr 2008
Posts: 1914

View Profile
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:
Code: [Select]
int draw_sprite_stretched_ext(int sprite,int subimg,double x,double y,double w,double h,int color,double alpha);
GSSprite.cpp:
Code: [Select]
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.
« Last Edit: September 26, 2010, 08:33:15 AM by HaRRiKiRi » Logged
Offline (Male) Josh @ Dreamland
Reply #1 Posted on: September 09, 2010, 05:01:02 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2946

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TheExDeus
Reply #2 Posted on: September 10, 2010, 04:20:25 AM

Developer
Joined: Apr 2008
Posts: 1914

View Profile
Yes, it works. I will make others now.
Logged
Offline (Male) Josh @ Dreamland
Reply #3 Posted on: October 16, 2010, 01:34:54 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2946

View Profile Email
Integrated for next revision.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: [1]
  Print