[Change] Replaced unused and depricated gl_blitRotate with gl_blitScale.
This commit is contained in:
parent
9ad57087c2
commit
c7e2a69d91
44
src/opengl.c
44
src/opengl.c
@ -607,26 +607,44 @@ void gl_blitStaticSprite(const glTexture* sprite, const double bx,
|
|||||||
gl_blitTexture(sprite, x, y, tx, ty, c);
|
gl_blitTexture(sprite, x, y, tx, ty, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Like gl_blitSprite but will use the actual direction, for things that */
|
/* Like gl_blitStatic but scales to size. */
|
||||||
/* can just rotate around. */
|
void gl_blitScale(const glTexture* texture,
|
||||||
void gl_blitRotate(const glTexture* texture,
|
|
||||||
const double bx, const double by,
|
const double bx, const double by,
|
||||||
const double dir, const glColour* c) {
|
const double bw, const double bh, const glColour* c) {
|
||||||
|
|
||||||
double x, y;
|
double x, y;
|
||||||
|
double tw, th;
|
||||||
|
double tx, ty;
|
||||||
|
|
||||||
/* Calculate position - we'll use relative coords to player. */
|
/* Here we use absolute coords. */
|
||||||
x = bx - VX(*gl_camera) - texture->sw/2. + gui_xoff;
|
x = bx - (double)SCREEN_W/2.;
|
||||||
y = by - VY(*gl_camera) - texture->sh/2. + gui_yoff;
|
y = by - (double)SCREEN_H/2.;
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
/* Texture dimensions. */
|
||||||
glPushMatrix();
|
tw = texture->sw / texture->rw;
|
||||||
glRotated(dir, 0., 0., 1.);
|
th = texture->sh / texture->rh;
|
||||||
|
tx = ty = 0.;
|
||||||
|
|
||||||
/* Blit. */
|
glEnable(GL_TEXTURE_2D);
|
||||||
gl_blitTexture(texture, x, y, 0, 0, c);
|
glBindTexture(GL_TEXTURE_2D, texture->texture);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
/* Set colour or default if not set. */
|
||||||
|
if(c == NULL) glColor4d(1., 1., 1., 1.);
|
||||||
|
else COLOUR(*c);
|
||||||
|
|
||||||
glPopMatrix(); /* GL_PROJECTION. */
|
glTexCoord2d(tx, ty);
|
||||||
|
glVertex2d(x, y);
|
||||||
|
|
||||||
|
glTexCoord2d(tx+tw, ty);
|
||||||
|
glVertex2d(x+bw, y+bh);
|
||||||
|
|
||||||
|
glTexCoord2d(tx, ty+th);
|
||||||
|
glVertex2d(x, y+bh);
|
||||||
|
glEnd();
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
/* Anything failed? */
|
||||||
|
gl_checkErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just straight out blit the thing at position. */
|
/* Just straight out blit the thing at position. */
|
||||||
|
@ -81,10 +81,10 @@ void gl_blitStaticSprite(const glTexture* sprite,
|
|||||||
const double bx, const double by,
|
const double bx, const double by,
|
||||||
const int sx, const int sy, const glColour* c);
|
const int sx, const int sy, const glColour* c);
|
||||||
|
|
||||||
/* Blits a texture rotated, relative pos. */
|
/* Blit a texture scaled, absolure pos. */
|
||||||
void gl_blitRotate(const glTexture* texture,
|
void gl_blitScale(const glTexture* texture,
|
||||||
const double bx, const double by,
|
const double bx, const double by,
|
||||||
const double dir, const glColour* c);
|
const double bw, const double bh, const glColour* c);
|
||||||
|
|
||||||
/* Blit the entire image, absolute pos. */
|
/* Blit the entire image, absolute pos. */
|
||||||
void gl_blitStatic(const glTexture* texture, const double bx, const double by,
|
void gl_blitStatic(const glTexture* texture, const double bx, const double by,
|
||||||
|
Loading…
Reference in New Issue
Block a user