Fixes for datatype size on amd64.
[crack-attack.git] / src / obj_clock.cxx
blobd30dd5c15fc341ee68aa4a87cf791b6b23a01dc7
1 /*
2 * clock.cxx
3 * Daniel Nelson - 11/2/0
5 * Copyright (C) 2000 Daniel Nelson
6 * Copyright (C) 2004 Andrew Sayman
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * Daniel Nelson - aluminumangel.org
23 * 174 W. 18th Ave.
24 * Columbus, OH 43210
26 * Generates the textures for the clock.
29 #include <GL/glut.h>
31 #include "glext.h"
33 #include "TextureLoader.h"
34 #include "Game.h"
35 #include "Displayer.h"
37 GLuint Displayer::clock_digit_textures[11];
39 const char *clock_digit_texture_files[11]
40 = { GC_DATA_DIRECTORY("clock_0.tga"),
41 GC_DATA_DIRECTORY("clock_1.tga"),
42 GC_DATA_DIRECTORY("clock_2.tga"),
43 GC_DATA_DIRECTORY("clock_3.tga"),
44 GC_DATA_DIRECTORY("clock_4.tga"),
45 GC_DATA_DIRECTORY("clock_5.tga"),
46 GC_DATA_DIRECTORY("clock_6.tga"),
47 GC_DATA_DIRECTORY("clock_7.tga"),
48 GC_DATA_DIRECTORY("clock_8.tga"),
49 GC_DATA_DIRECTORY("clock_9.tga"),
50 GC_DATA_DIRECTORY("clock_extra.tga") };
52 void Displayer::generateClock ( )
54 GLubyte *texture;
56 glGenTextures(11, clock_digit_textures);
58 for (int n = 11; n--; ) {
60 glBindTexture(GL_TEXTURE_2D, clock_digit_textures[n]);
62 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
63 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
64 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
65 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
67 texture = TextureLoader::loadImageAlpha(clock_digit_texture_files[n],
68 DC_CLOCK_TEX_LENGTH, DC_CLOCK_TEX_LENGTH);
70 glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, DC_CLOCK_TEX_LENGTH,
71 DC_CLOCK_TEX_LENGTH, GL_FALSE, GL_ALPHA, GL_UNSIGNED_BYTE, texture);
73 if (texture != null) {
74 delete [] texture;
75 texture = null;