ew-engine/mq engine src/gl_crosshair.c
2006-10-08 00:00:00 +00:00

64 lines
No EOL
1.6 KiB
C

/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
int crosshair_texture[11];
/*
==============
Crosshair_Init
==============
*/
void Crosshair_Init (void)
{
int i;
for (i=1; i<11; i++)
crosshair_texture[i] = loadtextureimage (va("gfx/crosshairs/crosshair%i", i), false, true);
}
/*
==============
Draw_Crosshair
==============
*/
void Draw_Crosshair (int num)
{
int x = 0;
int y = 0;
x = (vid.width /2) - 16;
y = (vid.height/2) - 8;
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture (GL_TEXTURE_2D, crosshair_texture[num]);
glBegin (GL_QUADS);
glTexCoord2f (0,0); glVertex2f (x, y);
glTexCoord2f (1,0); glVertex2f (x + 32, y);
glTexCoord2f (1,1); glVertex2f (x + 32, y + 32);
glTexCoord2f (0,1); glVertex2f (x, y + 32);
glEnd ();
// restore display settings
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}