xref: /haiku/src/libs/glut/glut_stroke.c (revision 4bd0c1066b227cec4b79883bdef697c7a27f2e90)
1 /*
2  * Copyright 1994-1997 Mark Kilgard, All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * GPL licensing not permitted.
6  *
7  * Authors:
8  *      Mark Kilgard
9  */
10 
11 
12 #include "glutint.h"
13 #include "glutstroke.h"
14 
15 
16 void APIENTRY
17 glutStrokeCharacter(GLUTstrokeFont font, int c)
18 {
19   const StrokeCharRec *ch;
20   const StrokeRec *stroke;
21   const CoordRec *coord;
22   StrokeFontPtr fontinfo;
23   int i, j;
24 
25 
26 #if defined(_WIN32)
27   fontinfo = (StrokeFontPtr) __glutFont(font);
28 #else
29   fontinfo = (StrokeFontPtr) font;
30 #endif
31 
32   if (c < 0 || c >= fontinfo->num_chars)
33     return;
34   ch = &(fontinfo->ch[c]);
35   if (ch) {
36     for (i = ch->num_strokes, stroke = ch->stroke;
37       i > 0; i--, stroke++) {
38       glBegin(GL_LINE_STRIP);
39       for (j = stroke->num_coords, coord = stroke->coord;
40         j > 0; j--, coord++) {
41         glVertex2f(coord->x, coord->y);
42       }
43       glEnd();
44     }
45     glTranslatef(ch->right, 0.0, 0.0);
46   }
47 }
48