1 // License information.
2 // The Software "SAF BENCH" was written by Patrik.A, also known as Nitton Attiofyra
3 // on YouTube. (https://www.youtube.com/@NittonAttiofyra)
5 // The software is released in to the Public Domain and comes with no warranty and is used
8 #include <stdlib.h> // VS 2005 wont compile it if its noth placed here, need to investigate
20 #include "bmp_alpha.h"
23 #define for if(0);else for // C2374 VC6++ on Alpha bug
26 #pragma warning( disable : 4305 )
27 #define for if(0);else for // VC6++ on Alpha bug
30 int draw_fps[5]; // array that holds up to 5 digits that represents etch digit in the FPS number
31 int draw_score[8] = { // array that holds up to 8 digits that represents etch digit in the Score number
35 static GLuint textures_digits_1; // Textures
38 void textures_digits()
41 textures_digits_1 = LoadTexture(":textures:menu:digits.bmp", 64, 64);
43 textures_digits_1 = LoadTexture("textures/menu/digits.bmp", 64, 64);
47 // render fps counter on screen
50 for (int i = 0; i < 5; ++i)
53 glBindTexture( GL_TEXTURE_2D, textures_digits_1 );
54 glEnable(GL_TEXTURE_2D);
63 glTexCoord2f(0,-.25);glVertex3f(3 - i, 10, -20); // Top Left
64 glTexCoord2f(.25,-.25);glVertex3f(4 - i,10, -20); // Top Right
65 glTexCoord2f(.25,0);glVertex3f(4 - i, 11, -20); // Bottom Rigth
66 glTexCoord2f(0,0);glVertex3f(3 - i, 11, -20); // Bottom Left
70 glTexCoord2f(.25,-.25);glVertex3f(3 - i, 10, -20); // Top Left
71 glTexCoord2f(.5,-.25);glVertex3f(4 - i,10, -20); // Top Right
72 glTexCoord2f(.5,0);glVertex3f(4 - i, 11, -20); // Bottom Rigth
73 glTexCoord2f(.25,0);glVertex3f(3 - i, 11, -20); // Bottom Left
77 glTexCoord2f(.5,-.25);glVertex3f(3 - i, 10, -20); // Top Left
78 glTexCoord2f(.75,-.25);glVertex3f(4 - i,10, -20); // Top Right
79 glTexCoord2f(.75,0);glVertex3f(4 - i, 11, -20); // Bottom Rigth
80 glTexCoord2f(.5,0);glVertex3f(3 - i, 11, -20); // Bottom Left
84 glTexCoord2f(.75,-.25);glVertex3f(3 - i, 10, -20); // Top Left
85 glTexCoord2f(1,-.25);glVertex3f(4 - i,10, -20); // Top Right
86 glTexCoord2f(1,0);glVertex3f(4 - i, 11, -20); // Bottom Rigth
87 glTexCoord2f(.75,0);glVertex3f(3 - i, 11, -20); // Bottom Left
91 glTexCoord2f(0,-.5);glVertex3f(3 - i, 10, -20); // Top Left
92 glTexCoord2f(.25,-.5);glVertex3f(4 - i,10, -20); // Top Right
93 glTexCoord2f(.25,-.25);glVertex3f(4 - i, 11, -20); // Bottom Rigth
94 glTexCoord2f(0,-.25);glVertex3f(3 - i, 11, -20); // Bottom Left
98 glTexCoord2f(.25,-.5);glVertex3f(3 - i, 10, -20); // Top Left
99 glTexCoord2f(.5,-.5);glVertex3f(4 - i,10, -20); // Top Right
100 glTexCoord2f(.5,-.25);glVertex3f(4 - i, 11, -20); // Bottom Rigth
101 glTexCoord2f(.25,-.25);glVertex3f(3 - i, 11, -20); // Bottom Left
105 glTexCoord2f(.5,-.5);glVertex3f(3 - i, 10, -20); // Top Left
106 glTexCoord2f(.75,-.5);glVertex3f(4 - i,10, -20); // Top Right
107 glTexCoord2f(.75,-.25);glVertex3f(4 - i, 11, -20); // Bottom Rigth
108 glTexCoord2f(.5,-.25);glVertex3f(3 - i, 11, -20); // Bottom Left
112 glTexCoord2f(.75,-.5);glVertex3f(3 - i, 10, -20); // Top Left
113 glTexCoord2f(1,-.5);glVertex3f(4 - i,10, -20); // Top Right
114 glTexCoord2f(1,-.25);glVertex3f(4 - i, 11, -20); // Bottom Rigth
115 glTexCoord2f(.75,-.25);glVertex3f(3 - i, 11, -20); // Bottom Left
119 glTexCoord2f(0,-.75);glVertex3f(3 - i, 10, -20); // Top Left
120 glTexCoord2f(.25,-.75);glVertex3f(4 - i,10, -20); // Top Right
121 glTexCoord2f(.25,-.5);glVertex3f(4 - i, 11, -20); // Bottom Rigth
122 glTexCoord2f(0,-.5);glVertex3f(3 - i, 11, -20); // Bottom Left
126 glTexCoord2f(.25,-.75);glVertex3f(3 - i, 10, -20); // Top Left
127 glTexCoord2f(.5,-.75);glVertex3f(4 - i,10, -20); // Top Right
128 glTexCoord2f(.5,-.5);glVertex3f(4 - i, 11, -20); // Bottom Rigth
129 glTexCoord2f(.25,-.5);glVertex3f(3 - i, 11, -20); // Bottom Left
134 // Draw the text "FPS" on screen
138 glTexCoord2f(.5,-.75);glVertex3f(4 , 10, -20); // Top Left
139 glTexCoord2f(1,-.75);glVertex3f(6 ,10, -20); // Top Right
140 glTexCoord2f(1,-.5);glVertex3f(6 , 11, -20); // Bottom Rigth
141 glTexCoord2f(.5,-.5);glVertex3f(4 , 11, -20); // Bottom Left
145 glDisable(GL_TEXTURE_2D);
148 // render score counter on screen
151 for (int i = 0; i < 8; ++i)
154 glBindTexture( GL_TEXTURE_2D, textures_digits_1 );
155 glEnable(GL_TEXTURE_2D);
160 switch(draw_score[i])
164 glTexCoord2f(0,-.25);glVertex3f(5 - i, -2, -12); // Top Left
165 glTexCoord2f(.25,-.25);glVertex3f(6 - i, -2, -12); // Top Right
166 glTexCoord2f(.25,0);glVertex3f(6 - i, -1, -12); // Bottom Rigth
167 glTexCoord2f(0,0);glVertex3f(5 - i, -1, -12); // Bottom Left
171 glTexCoord2f(.25,-.25);glVertex3f(5 - i, -2, -12); // Top Left
172 glTexCoord2f(.5,-.25);glVertex3f(6 - i, -2, -12); // Top Right
173 glTexCoord2f(.5,0);glVertex3f(6 - i, -1, -12); // Bottom Rigth
174 glTexCoord2f(.25,0);glVertex3f(5 - i, -1, -12); // Bottom Left
178 glTexCoord2f(.5,-.25);glVertex3f(5 - i, -2, -12); // Top Left
179 glTexCoord2f(.75,-.25);glVertex3f(6 - i, -2, -12); // Top Right
180 glTexCoord2f(.75,0);glVertex3f(6 - i, -1, -12); // Bottom Rigth
181 glTexCoord2f(.5,0);glVertex3f(5 - i, -1, -12); // Bottom Left
185 glTexCoord2f(.75,-.25);glVertex3f(5 - i, -2, -12); // Top Left
186 glTexCoord2f(1,-.25);glVertex3f(6 - i, -2, -12); // Top Right
187 glTexCoord2f(1,0);glVertex3f(6 - i, -1, -12); // Bottom Rigth
188 glTexCoord2f(.75,0);glVertex3f(5 - i, -1, -12); // Bottom Left
192 glTexCoord2f(0,-.5);glVertex3f(5 - i, -2, -12); // Top Left
193 glTexCoord2f(.25,-.5);glVertex3f(6 - i, -2, -12); // Top Right
194 glTexCoord2f(.25,-.25);glVertex3f(6 - i, -1, -12); // Bottom Rigth
195 glTexCoord2f(0,-.25);glVertex3f(5 - i, -1, -12); // Bottom Left
199 glTexCoord2f(.25,-.5);glVertex3f(5 - i, -2, -12); // Top Left
200 glTexCoord2f(.5,-.5);glVertex3f(6 - i, -2, -12); // Top Right
201 glTexCoord2f(.5,-.25);glVertex3f(6 - i, -1, -12); // Bottom Rigth
202 glTexCoord2f(.25,-.25);glVertex3f(5 - i, -1, -12); // Bottom Left
206 glTexCoord2f(.5,-.5);glVertex3f(5 - i, -2, -12); // Top Left
207 glTexCoord2f(.75,-.5);glVertex3f(6 - i, -2, -12); // Top Right
208 glTexCoord2f(.75,-.25);glVertex3f(6 - i, -1, -12); // Bottom Rigth
209 glTexCoord2f(.5,-.25);glVertex3f(5 - i, -1, -12); // Bottom Left
213 glTexCoord2f(.75,-.5);glVertex3f(5 - i, -2, -12); // Top Left
214 glTexCoord2f(1,-.5);glVertex3f(6 - i, -2, -12); // Top Right
215 glTexCoord2f(1,-.25);glVertex3f(6 - i, -1, -12); // Bottom Rigth
216 glTexCoord2f(.75,-.25);glVertex3f(5 - i, -1, -12); // Bottom Left
220 glTexCoord2f(0,-.75);glVertex3f(5 - i, -2, -12); // Top Left
221 glTexCoord2f(.25,-.75);glVertex3f(6 - i, -2, -12); // Top Right
222 glTexCoord2f(.25,-.5);glVertex3f(6 - i, -1, -12); // Bottom Rigth
223 glTexCoord2f(0,-.5);glVertex3f(5 - i, -1, -12); // Bottom Left
227 glTexCoord2f(.25,-.75);glVertex3f(5 - i, -2, -12); // Top Left
228 glTexCoord2f(.5,-.75);glVertex3f(6 - i, -2, -12); // Top Right
229 glTexCoord2f(.5,-.5);glVertex3f(6 - i, -1, -12); // Bottom Rigth
230 glTexCoord2f(.25,-.5);glVertex3f(5 - i, -1, -12); // Bottom Left
236 glDisable(GL_TEXTURE_2D);