[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);
|
||||
}
|
||||
|
||||
/* Like gl_blitSprite but will use the actual direction, for things that */
|
||||
/* can just rotate around. */
|
||||
void gl_blitRotate(const glTexture* texture,
|
||||
/* Like gl_blitStatic but scales to size. */
|
||||
void gl_blitScale(const glTexture* texture,
|
||||
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 tw, th;
|
||||
double tx, ty;
|
||||
|
||||
/* Calculate position - we'll use relative coords to player. */
|
||||
x = bx - VX(*gl_camera) - texture->sw/2. + gui_xoff;
|
||||
y = by - VY(*gl_camera) - texture->sh/2. + gui_yoff;
|
||||
/* Here we use absolute coords. */
|
||||
x = bx - (double)SCREEN_W/2.;
|
||||
y = by - (double)SCREEN_H/2.;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glRotated(dir, 0., 0., 1.);
|
||||
/* Texture dimensions. */
|
||||
tw = texture->sw / texture->rw;
|
||||
th = texture->sh / texture->rh;
|
||||
tx = ty = 0.;
|
||||
|
||||
/* Blit. */
|
||||
gl_blitTexture(texture, x, y, 0, 0, c);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
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. */
|
||||
|
@ -81,10 +81,10 @@ void gl_blitStaticSprite(const glTexture* sprite,
|
||||
const double bx, const double by,
|
||||
const int sx, const int sy, const glColour* c);
|
||||
|
||||
/* Blits a texture rotated, relative pos. */
|
||||
void gl_blitRotate(const glTexture* texture,
|
||||
/* Blit a texture scaled, absolure pos. */
|
||||
void gl_blitScale(const glTexture* texture,
|
||||
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. */
|
||||
void gl_blitStatic(const glTexture* texture, const double bx, const double by,
|
||||
|
Loading…
Reference in New Issue
Block a user