Mar 20, 2011 at 12:40pm Mar 20, 2011 at 12:40pm UTC
You don't give enough information to tell why s++ doesn't work. Anyway, try
qva_Fonts[ s[letter] ]-> draw();
Mar 20, 2011 at 1:30pm Mar 20, 2011 at 1:30pm UTC
"s*" is a character array.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
void CFonts::DrawText(char *s, GLfloat gfText_PosX, GLfloat gfText_PosY, GLfloat gfFont_Size, GLfloat gfFont_Spacing)
{
const int ki_end = strlen(s);
//for loop drawing each letter
for (int letter = 0;letter != ki_end ;letter++)
{
//draw font in array
qva_Fonts[(int )*s]-> draw();
s++;
//loadmatrix Position & Scalling
gfaaSca[0] = gfFont_Size;
gfaaSca[5] = gfFont_Size;
gfaaSca[10] = gfFont_Size;
gfaaSca[15] = gfFont_Size;
gfText_PosX += gfFont_Spacing;
gfaaPos[12] = gfText_PosX;
gfaaPos[13] = gfText_PosY;
//multiply matrix
glMultMatrixf(gfaaSca);
glMultMatrixf(gfaaPos);
glLoadMatrixf(gfaaSca); glLoadMatrixf(gfaaPos);
}
glLoadIdentity();
}
Last edited on Mar 20, 2011 at 1:30pm Mar 20, 2011 at 1:30pm UTC
Mar 20, 2011 at 1:43pm Mar 20, 2011 at 1:43pm UTC
So...? Does it still not work?
By the way, you don't have to use strlen. If you're not going to use 'letter' for anything, you may write for (;*s != 0; s++){ ... }
.
Mar 20, 2011 at 1:43pm Mar 20, 2011 at 1:43pm UTC
So... Did it work for you? We are trying to help but most of us will NOT compile some random code we find on this site so you'll have to tell us if this did the trick. Also you haven't stated a goal yet so I'm not sure that we're even headed in the right direction with this code.
Last edited on Mar 20, 2011 at 1:44pm Mar 20, 2011 at 1:44pm UTC
Mar 20, 2011 at 8:22pm Mar 20, 2011 at 8:22pm UTC
success guys it worked
"*s" accesses an element
"s++" shifts to the next letter
Anyway I was plagued by the two many errors which caused me to get lost