int TextInput::Input(char score[]) { Ocean2 ocean; ocean.ReadFigure(); Congratulation cong; cong.ReadFigure(); FsPollDevice(); while(FSKEY_NULL!=FsInkey() || 0!=FsInkeyChar()) { FsPollDevice(); } int count=0; for(;;) { FsPollDevice(); int key=FsInkey(); switch(key) { case FSKEY_ESC: return 0; case FSKEY_ENTER: return 1; case FSKEY_BS: str.BackSpace(); count--; break; } const char c=FsInkeyChar(); if(0!=c && 0!=isprint(c) && count<10) { str.Add(c); count++; } glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); cong.Drawcongratulation_png(); glRasterPos2d(460, 200); YsGlDrawFontBitmap20x32("SCORE"); glRasterPos2d(400, 200+50); YsGlDrawFontBitmap20x32(score); Drawocean2(450); ocean.Drawocean_png(); Draw(); FsSwapBuffers(); FsSleep(20); } return 0; }
void GameMenu::RunGameMenu2(void) { while(FSKEY_NULL!=FsInkey() || 0!=FsInkeyChar()) { FsPollDevice(); } key=FSKEY_NULL; for(;;) { FsPollDevice(); key=FsInkey(); if(key==FSKEY_ESC || key==FSKEY_S || key==FSKEY_M) { return; } glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); Initialize(); DrawBackground(); DrawObjects(); DrawWelcomeText(); DrawLogo(25, 575); FsSwapBuffers(); FsSleep(20); } }
void FsClearEventQueue(void) { for(;;) { int checkAgain=0; FsPollDevice(); int lb,mb,rb,mx,my; while(FSMOUSEEVENT_NONE!=FsGetMouseEvent(lb,mb,rb,mx,my) || FSKEY_NULL!=FsInkey() || 0!=FsInkeyChar() || 0!=FsCheckWindowExposure()) { checkAgain=1; } if(0!=lb || 0!=rb || 0!=mb) { checkAgain=1; } if(0!=FsCheckKeyHeldDown()) { checkAgain=1; } if(0==checkAgain) { break; } FsSleep(50); } }
void Button::Remap2() { FsClearEventQueue(); FsGetWindowSize (windowWid, windowHei); while(FSKEY_NULL!=FsInkey() || 0!=FsInkeyChar()) { FsPollDevice(); } //Initialize(); while(SF2==0 || checkGameControl(SF2) ) { FsPollDevice(); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); DrawBackground(); DrawModeTitle2(); DrawKeyboardSetting(); double y=180.0; double dy=40.0; glColor3ub(255, 255, 255); glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Up : (press key to remap)"); DrawLogo(25, 575); SF2=FsInkey(); FsSwapBuffers(); FsSleep(20); } while(SB2==0 || checkGameControl(SB2)) { FsPollDevice(); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); DrawBackground(); DrawModeTitle2(); DrawKeyboardSetting(); double y=180.0; double dy=40.0; glColor3ub(155, 155, 155); glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Up : (OK)"); y+=dy; glColor3ub(255, 255, 255); glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Down : (press key to remap)"); DrawLogo(25, 575); SB2=FsInkey(); FsSwapBuffers(); FsSleep(20); } while(SL2==0 || checkGameControl(SL2)) { FsPollDevice(); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); DrawBackground(); DrawModeTitle2(); DrawKeyboardSetting(); double y=180.0; double dy=40.0; glColor3ub(155, 155, 155); glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Up : (OK)"); y+=dy; glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Down : (OK)"); y+=dy; glColor3ub(255, 255, 255); glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Left : (press key to remap)"); DrawLogo(25, 575); SL2=FsInkey(); FsSwapBuffers(); FsSleep(20); } while(SR2==0 || checkGameControl(SR2)) { FsPollDevice(); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); DrawBackground(); DrawModeTitle2(); DrawKeyboardSetting(); double y=180.0; double dy=40.0; glColor3ub(155, 155, 155); glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Up : (OK)"); y+=dy; glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Down : (OK)"); y+=dy; glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Left : (OK)"); y+=dy; glColor3ub(255, 255, 255); glRasterPos2d(100,y); YsGlDrawFontBitmap16x20 ("Right : (press key to remap)"); DrawLogo(25, 575); SR2=FsInkey(); FsSwapBuffers(); FsSleep(20); } }