resizer demo:

some breaks missing in keyboard switch
added instruction text for which buttons can be pressed

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1699 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2014-08-27 05:47:05 +00:00
parent a894e63bdd
commit f57980927a

View File

@ -194,7 +194,7 @@ void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY )
glutTimerFunc(2000, UnhideTimer, nWindow); glutTimerFunc(2000, UnhideTimer, nWindow);
} }
glutHideWindow(); glutHideWindow();
break;
case 'p': case 'p':
case 'P': case 'P':
@ -214,6 +214,7 @@ void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY )
else else
glutSetCursor(GLUT_CURSOR_CYCLE); glutSetCursor(GLUT_CURSOR_CYCLE);
} }
break;
default: default:
break; break;
@ -275,6 +276,7 @@ void WindowStatus(int state)
void Redisplay(void) void Redisplay(void)
{ {
int win = glutGetWindow(); int win = glutGetWindow();
int viewport[4];
if (win==nWindow) if (win==nWindow)
{ {
@ -291,6 +293,14 @@ void Redisplay(void)
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
DrawQuad(); DrawQuad();
if (win==nWindow)
{
glColor3f(1, 1, 0);
glGetIntegerv(GL_VIEWPORT, viewport);
glRasterPos2i(2, -glutBitmapHeight(GLUT_BITMAP_9_BY_15)+3+viewport[3]);
glutBitmapString(GLUT_BITMAP_9_BY_15, (unsigned char*)"press f/r/m/d/c/i/h/p");
}
glutSwapBuffers(); glutSwapBuffers();
glutPostWindowRedisplay(win); glutPostWindowRedisplay(win);
} }