X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2FResizer%2FResizer.cpp;h=85ce4b890e0dbd21a0c5f4e581116d3eade8d4c5;hb=897c62cf034695c0f2224955550aadabb59ec342;hp=163123f8d31cd3012cfdf3d04c69e5269626db8d;hpb=99d53f15a4216240088132f6af9cb194b519b1cc;p=freeglut diff --git a/progs/demos/Resizer/Resizer.cpp b/progs/demos/Resizer/Resizer.cpp index 163123f..85ce4b8 100644 --- a/progs/demos/Resizer/Resizer.cpp +++ b/progs/demos/Resizer/Resizer.cpp @@ -194,6 +194,39 @@ void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) glutTimerFunc(2000, UnhideTimer, nWindow); } glutHideWindow(); + break; + + case 'p': + case 'P': + if (nChildWindow!=-1 && cChar=='p') /* Capital P always changes pointer for the main window*/ + { + glutSetWindow(nChildWindow); + if (glutGet(GLUT_WINDOW_CURSOR)==GLUT_CURSOR_TOP_SIDE) + { + glutSetCursor(GLUT_CURSOR_RIGHT_ARROW); + printf("reverting child window cursor\n"); + } + else + { + glutSetCursor(GLUT_CURSOR_TOP_SIDE); + printf("changing child window cursor\n"); + } + } + else + { + glutSetWindow(nWindow); + if (glutGet(GLUT_WINDOW_CURSOR)==GLUT_CURSOR_CYCLE) + { + glutSetCursor(GLUT_CURSOR_RIGHT_ARROW); + printf("reverting main window cursor\n"); + } + else + { + glutSetCursor(GLUT_CURSOR_CYCLE); + printf("changing main window cursor\n"); + } + } + break; default: break; @@ -255,6 +288,7 @@ void WindowStatus(int state) void Redisplay(void) { int win = glutGetWindow(); + int viewport[4]; if (win==nWindow) { @@ -271,6 +305,14 @@ void Redisplay(void) glClear(GL_COLOR_BUFFER_BIT); 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(); glutPostWindowRedisplay(win); } @@ -304,7 +346,7 @@ void Timer(int unused) width, height, x ,y, x-border, - y-border-caption); + y-caption); else printf("child window %dx%d, top-left of client at: (%d,%d), relative to parent\n", width, height, @@ -350,4 +392,4 @@ int main(int argc, char* argv[]) printf("glutMainLoop returned\n"); return EXIT_SUCCESS; -} \ No newline at end of file +}