84 void print_string(
float x,
float y,
char *text,
float r,
float g,
float b)
92 glEnableClientState(GL_VERTEX_ARRAY);
93 glVertexPointer(2, GL_FLOAT, 16, buffer);
94 glDrawArrays(GL_QUADS, 0, num_quads*4);
95 glDisableClientState(GL_VERTEX_ARRAY);
99 #ifndef INCLUDE_STB_EASY_FONT_H 100 #define INCLUDE_STB_EASY_FONT_H 110 { 5, 0, 0 }, { 3, 0, 0 }, { 5, 1, 1 }, { 7, 1, 4 },
111 { 7, 3, 7 }, { 7, 6, 12 }, { 7, 8, 19 }, { 4, 16, 21 },
112 { 4, 17, 22 }, { 4, 19, 23 }, { 23, 21, 24 }, { 23, 22, 31 },
113 { 20, 23, 34 }, { 22, 23, 36 }, { 19, 24, 36 }, { 21, 25, 36 },
114 { 6, 25, 39 }, { 6, 27, 43 }, { 6, 28, 45 }, { 6, 30, 49 },
115 { 6, 33, 53 }, { 6, 34, 57 }, { 6, 40, 58 }, { 6, 46, 59 },
116 { 6, 47, 62 }, { 6, 55, 64 }, { 19, 57, 68 }, { 20, 59, 68 },
117 { 21, 61, 69 }, { 22, 66, 69 }, { 21, 68, 69 }, { 7, 73, 69 },
118 { 9, 75, 74 }, { 6, 78, 81 }, { 6, 80, 85 }, { 6, 83, 90 },
119 { 6, 85, 91 }, { 6, 87, 95 }, { 6, 90, 96 }, { 7, 92, 97 },
120 { 6, 96,102 }, { 5, 97,106 }, { 6, 99,107 }, { 6,100,110 },
121 { 6,100,115 }, { 7,101,116 }, { 6,101,121 }, { 6,101,125 },
122 { 6,102,129 }, { 7,103,133 }, { 6,104,140 }, { 6,105,145 },
123 { 7,107,149 }, { 6,108,151 }, { 7,109,155 }, { 7,109,160 },
124 { 7,109,165 }, { 7,118,167 }, { 6,118,172 }, { 4,120,176 },
125 { 6,122,177 }, { 4,122,181 }, { 23,124,182 }, { 22,129,182 },
126 { 4,130,182 }, { 22,131,183 }, { 6,133,187 }, { 22,135,191 },
127 { 6,137,192 }, { 22,139,196 }, { 5,144,197 }, { 22,147,198 },
128 { 6,150,202 }, { 19,151,206 }, { 21,152,207 }, { 6,155,209 },
129 { 3,160,210 }, { 23,160,211 }, { 22,164,216 }, { 22,165,220 },
130 { 22,167,224 }, { 22,169,228 }, { 21,171,232 }, { 21,173,233 },
131 { 5,178,233 }, { 22,179,234 }, { 23,180,238 }, { 23,180,243 },
132 { 23,180,248 }, { 22,189,248 }, { 22,191,252 }, { 5,196,252 },
133 { 3,203,252 }, { 5,203,253 }, { 22,210,253 }, { 0,214,253 },
137 97,37,69,84,28,51,2,18,10,49,98,41,65,25,81,105,33,9,97,1,97,37,37,36,
138 81,10,98,107,3,100,3,99,58,51,4,99,58,8,73,81,10,50,98,8,73,81,4,10,50,
139 98,8,25,33,65,81,10,50,17,65,97,25,33,25,49,9,65,20,68,1,65,25,49,41,
140 11,105,13,101,76,10,50,10,50,98,11,99,10,98,11,50,99,11,50,11,99,8,57,
141 58,3,99,99,107,10,10,11,10,99,11,5,100,41,65,57,41,65,9,17,81,97,3,107,
142 9,97,1,97,33,25,9,25,41,100,41,26,82,42,98,27,83,42,98,26,51,82,8,41,
143 35,8,10,26,82,114,42,1,114,8,9,73,57,81,41,97,18,8,8,25,26,26,82,26,82,
144 26,82,41,25,33,82,26,49,73,35,90,17,81,41,65,57,41,65,25,81,90,114,20,
145 84,73,57,41,49,25,33,65,81,9,97,1,97,25,33,65,81,57,33,25,41,25,
149 4,2,8,10,15,8,15,33,8,15,8,73,82,73,57,41,82,10,82,18,66,10,21,29,1,65,
150 27,8,27,9,65,8,10,50,97,74,66,42,10,21,57,41,29,25,14,81,73,57,26,8,8,
151 26,66,3,8,8,15,19,21,90,58,26,18,66,18,105,89,28,74,17,8,73,57,26,21,
152 8,42,41,42,8,28,22,8,8,30,7,8,8,26,66,21,7,8,8,29,7,7,21,8,8,8,59,7,8,
153 8,15,29,8,8,14,7,57,43,10,82,7,7,25,42,25,15,7,25,41,15,21,105,105,29,
154 7,57,57,26,21,105,73,97,89,28,97,7,57,58,26,82,18,57,57,74,8,30,6,8,8,
155 14,3,58,90,58,11,7,74,43,74,15,2,82,2,42,75,42,10,67,57,41,10,7,2,42,
156 74,106,15,2,35,8,8,29,7,8,8,59,35,51,8,8,15,35,30,35,8,8,30,7,8,8,60,
157 36,8,45,7,7,36,8,43,8,44,21,8,8,44,35,8,8,43,23,8,8,43,35,8,8,31,21,15,
158 20,8,8,28,18,58,89,58,26,21,89,73,89,29,20,8,8,30,7,
169 for (i=0; i < num_segs; ++i) {
170 int len = segs[i] & 7;
171 x += (float) ((segs[i] >> 3) & 1);
172 if (len && offset+64 <= vbuf_size) {
173 float y0 = y + (float) (segs[i]>>4);
174 for (j=0; j < 4; ++j) {
175 * (
float *) (vbuf+offset+0) = x + (j==1 || j==2 ? (vertical ? 1 :
len) : 0);
176 * (
float *) (vbuf+offset+4) = y0 + ( j >= 2 ? (vertical ? len : 1) : 0);
177 * (
float *) (vbuf+offset+8) = 0.f;
189 stb_easy_font_spacing_val = spacing;
194 char *vbuf = (
char *) vertex_buffer;
199 if (color) { c.
c[0] = color[0]; c.
c[1] = color[1]; c.
c[2] = color[2]; c.
c[3] = color[3]; }
201 while (*text && offset < vbuf_size) {
207 float y_ch = advance & 16 ? y+1 :
y;
220 return (
unsigned) offset/64;
231 return (
int) ceil(len);
struct @8 stb_easy_font_charinfo[96]
GLint GLint GLint GLint GLint GLint y
static int stb_easy_font_print(float x, float y, char *text, unsigned char color[4], void *vertex_buffer, int vbuf_size)
static void stb_easy_font_spacing(float spacing)
static unsigned char stb_easy_font_hseg[214]
static float stb_easy_font_spacing_val
static int stb_easy_font_draw_segs(float x, float y, unsigned char *segs, int num_segs, int vertical, stb_easy_font_color c, char *vbuf, int vbuf_size, int offset)
GLboolean GLboolean GLboolean b
static unsigned char stb_easy_font_vseg[253]
static int stb_easy_font_width(char *text)
GLuint GLfloat GLfloat y0
GLdouble GLdouble GLdouble r
GLint GLint GLint GLint GLint x