- procedure TMenuDraw.text(x: integer; y: integer; text: string);
- var
- i, v, u: integer;
- c: real;
- begin
- glbindtexture(Gl_texture_2d, schrift);
- u := 25; //Breite eines Buchstaben in Pixel
- glpushmatrix;
- gltranslatef(x, y, 0);
- for i := 1 to length(text) do
- begin
- v := ord(text[i]); //ASCII-Zahl der Buchstaben filtern, für alle Buchstaben von a-z und A-Z
- if v = 48 then
- v := 61
- else if v < 58 then
- v := v + 3
- else if (v > 64) and (v < 92) then
- v := v - 65 + 26
- else if v > 96 then
- v := v - 97;
- if text[i] = ' ' then //Diverse Sonderzeichen!!
- v := 62;
- if text[i] = '-' then
- v := 63;
- if text[i] = '_' then
- v := 64;
- if text[i] = ':' then
- v := 65;
- if text[i] = '.' then
- v := 66;
- if text[i] = ',' then
- v := 67;
- if text[i] = '/' then
- v := 68;
- if text[i] = '=' then
- v := 69;
- if text[i] = '(' then
- v := 70;
- if text[i] = ')' then
- v := 71;
- if text[i] = ';' then
- v := 72;
- c := v * u / 2000;
- glbegin(GL_Quads);
- glTexCoord2f(c, 0);
- glvertex3f(0, 0, 0);
- glTexCoord2f(c + (u / 2000), 0);
- glvertex3f(7, 0, 0);
- glTexCoord2f(c + (u / 2000), 1);
- glvertex3f(7, 16, 0); //7= Länge vom Buchstaben in Pixel, 16= die Höhe!
- glTexCoord2f(c, 1);
- glvertex3f(0, 16, 0);
- glend;
- gltranslatef(7, 0, 0);
- end;
- glpopmatrix;
- end;