Fix window title, and ensure that the random integer is not forced to be zero (Thanks Richard Rauch!)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@196 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
puggles 2003-09-21 13:35:36 +00:00
parent 84c2c9381e
commit c0f2a92615

View File

@ -57,7 +57,7 @@ static void draw_level ( int num, double m00, double m01, double m10, double m11
for ( i = 0; i < 10; i++ ) for ( i = 0; i < 10; i++ )
{ {
int random = rand () * num_trans / RAND_MAX ; int random = (rand() >> 10) % num_trans;
float new_x = affine[random].a00 * current_x + affine[random].a01 * current_y + affine[random].b0 ; float new_x = affine[random].a00 * current_x + affine[random].a01 * current_y + affine[random].b0 ;
float new_y = affine[random].a10 * current_x + affine[random].a11 * current_y + affine[random].b1 ; float new_y = affine[random].a10 * current_x + affine[random].a11 * current_y + affine[random].b1 ;
@ -80,6 +80,8 @@ Display(void)
glEnd () ; glEnd () ;
glPopMatrix(); glPopMatrix();
// glutSwapBuffers(); /* Should NOT be here... This is a Single-Buffered Program! */
glutPostRedisplay(); /* Needed so that this function will be called again */ glutPostRedisplay(); /* Needed so that this function will be called again */
} }
@ -186,7 +188,7 @@ void readConfigFile ( char *fnme )
/* Read the window title */ /* Read the window title */
fgets ( inputline, 256, fptr ) ; fgets ( inputline, 256, fptr ) ;
sscanf ( inputline, "%s", window_title ) ; sscanf ( inputline, "%[a-zA-Z0-9!@#$%^&*()+=/\\_-\" ]", window_title ) ;
/* Read a comment line */ /* Read a comment line */
fgets ( inputline, 256, fptr ) ; fgets ( inputline, 256, fptr ) ;