28 using namespace VSFileSystem;
30 #define isspAce( chr ) \
31 ( (chr == '\t') || (chr == '\n') || (chr == '\v') || (chr == '\f') || (chr == '\r') \
37 void ShowColor(
float x,
float y,
float wid,
float hei,
float red,
float green,
float blue,
float alpha )
39 float cols[4] = {red, green, blue, alpha};
40 if (wid < 0 || hei < 0) {
41 printf(
"Cannot draw color with negative height or width\n" );
45 if (x+wid > 1) wid = 1-
x;
46 if (y-hei < -1) hei = -1+
y;
48 cout<<
"Displaying color at "<<x<<
","<<y<<
"\n";
49 cout<<
"with the dimensions of "<<wid<<
","<<hei<<
"\n";
50 cout<<
"With the color "<<red<<
","<<green<<
","<<blue<<
","<<alpha<<
"\n";
51 cout<<
"-----------------------------\n";
53 glDisable( GL_TEXTURE_2D );
56 glVertex2f( x, y-hei );
60 glVertex2f( x+wid, y );
62 glVertex2f( x+wid, y-hei );
64 glEnable( GL_TEXTURE_2D );
70 while ( *str && *str !=
'\\' && ( !
isspAce( *str ) ) ) {
72 length += glutStrokeWidth( GLUT_STROKE_ROMAN, mychar );
76 void ShowText(
float x,
float y,
float wid,
int size,
const char *str,
int no_end )
79 float font_size_float = rescale_font*5./100;
82 float font_size = size*rescale_font;
88 glDisable( GL_TEXTURE_2D );
91 glEnable( GL_LINE_SMOOTH );
93 float page_wid = wid/rescale_font;
94 glTranslatef( x, y, 0 );
95 glScalef( font_size, font_size, 1 );
96 end = no_end ? 0 : glutStrokeWidth( GLUT_STROKE_ROMAN,
'A' );
100 for (cur = 0; str[cur] !=
'\0'; cur++) {
101 cur_width = glutStrokeWidth( GLUT_STROKE_ROMAN, str[cur] );
103 if ( (width+end+
word_length( str+cur ) > page_wid || str[cur] ==
'\\') && str[cur+1] !=
'\0' ) {
106 for (
int i = 1;
i <= 3;
i++)
107 glutStrokeCharacter( GLUT_STROKE_ROMAN,
'.' );
113 glEnable( GL_LINE_SMOOTH );
115 glTranslatef( x, y-(++h)*font_size_float, 0 );
116 glScalef( font_size, font_size, 1 );
121 if (str[cur] !=
'\\')
122 glutStrokeCharacter( GLUT_STROKE_ROMAN, str[cur] );
126 glDisable( GL_LINE_SMOOTH );
131 float width = glutStrokeWidth( GLUT_STROKE_ROMAN, chr );
170 float sizex = 0, sizey = 0;
172 float tempx = 0, tempy = 0;
192 VSSprite *whichSprite = &MouseVSSprite;
193 switch(pointerStyle) {