/* ---------------------- perform the rendering C.Wang 0720, 2006 ---------------------- - / / ---------------------- perform the rendering C.Wang 0720, 2006 ---------------------- - */ void RenderIt(int skip) { FnViewport vp; // render the whole scene vp.ID(vID); vp.Render3D(cID, TRUE, TRUE); // get camera's data FnCamera camera; camera.ID(cID); float pos[3], fDir[3], uDir[3]; camera.GetPosition(pos); camera.GetDirection(fDir, uDir); // show frame rate static char string[128]; if (frame == 0) { FyTimerReset(0); } if (frame / 10 * 10 == frame) { float curTime; curTime = FyTimerCheckTime(0); sprintf(string, "Fps: %6.2f", frame / curTime); } frame += skip; if (frame >= 1000) { frame = 0; } FnText text; text.ID(textID); text.Begin(vID); text.Write(string, 20, 20, 255, 0, 0); char posS[256], fDirS[256], uDirS[256]; float cpos[3], apos[3], distance, height, length;// FnCharacter actor; actor.ID(actorID); FnObject terrain; terrain.ID(tID); sprintf(posS, "pos: %8.3f %8.3f %8.3f", pos[0], pos[1], pos[2]); sprintf(fDirS, "facing: %8.3f %8.3f %8.3f", fDir[0], fDir[1], fDir[2]); sprintf(uDirS, "up: %8.3f %8.3f %8.3f", uDir[0], uDir[1], uDir[2]); text.Write(posS, 20, 35, 255, 255, 0); text.Write(fDirS, 20, 50, 255, 255, 0); text.Write(uDirS, 20, 65, 255, 255, 0); text.End(); // swap buffer FySwapBuffers(); }
/*---------------------- perform the rendering C.Wang 0720, 2006 -----------------------*/ void RenderIt( int skip ) { if (now_mode == 1)MM.RenderIt(skip); if (now_mode == 2)OM.RenderIt(skip); if (now_mode == 3)SM.RenderIt(skip); if (now_mode == 4 || now_mode == 5)FM.RenderIt(skip); // swap buffer FySwapBuffers (); }
/*------------------------------------------------------------------------------- timer callback function which will be invoked by Fly2 System every 1/30 second C.Wang 0308, 2004 --------------------------------------------------------------------------------*/ void GameAI(int skip) { // render the scene FnViewport vp; vp.Object(vID); vp.Render3D(cID, TRUE, TRUE); int nV, nT; FyRenderBenchMark(&nT, &nV); FySwapBuffers(); }
//------------------------------------------------------------------------------------ // timer callback function which will be invoked by TheFly3D System every 1/30 second // C.Wang 0308, 2004 //------------------------------------------------------------------------------------ void GameAI(int skip) { if (mmID != FAILED_ID) { FnMedia md; md.Object(mmID); if (md.GetState() == MEDIA_STOPPED) { // after playing, delete the media object FyDeleteMediaPlayer(mmID); mmID = FAILED_ID; } else { return; } } FnLight lgt; lgt.Object(lID); lgt.Rotate(Z_AXIS, 0.5f, GLOBAL); FnObject model; model.Object(nID); model.Rotate(Z_AXIS, 3.0f, GLOBAL); // render the scene FnViewport vp; vp.Object(vID); vp.Render3D(cID, TRUE, TRUE); // show frame rate static char string[128]; if (frame == 0) { FyTimerReset(0); } if (frame/10*10 == frame) { float curTime; curTime = FyTimerCheckTime(0); sprintf(string, "Fps: %6.2f", frame/curTime); } frame += skip; if (frame >= 1000) { frame = 0; } FySwapBuffers(); }
void RenderIt(int skip){ float pos[3], fDir[3], uDir[3]; FnViewport vp; if(!stateMenu) {mouseInput.update();} //render the whole scene vp.ID(viewportID); if (!stateGhost) vp.Render3D(cameraID, TRUE, TRUE); if(stateMenu) vp.RenderSprites(sID2menu, FALSE, TRUE); // no clear the background but clear the z buffer else vp.RenderSprites(sID2, FALSE, TRUE); // no clear the background but clear the z buffer //show frame rate static char string[128]; if(frame == 0){ FyTimerReset(0); } if((frame/10)*10 == frame){ float curTime; curTime = FyTimerCheckTime(0); sprintf_s(string, "Fps: %6.2f", frame/curTime); } frame += skip; if(frame >= 1000){ frame = 0; } FnText text, charactorInfo,char_HP,info; text.ID(textID); charactorInfo.ID(textCharID); char_HP.ID(textHP_vID); info.ID(textInfo_vID); text.Begin(viewportID); charactorInfo.Begin(viewportID); text.Write(string, 20, 20, 255, 0, 0); //get camera's data camera.getCameraPos(pos); camera.getCameraDir(fDir, uDir); float fCameraAngle = camera.getCameraAngle(); char posS[256], fDirS[256], uDirS[256]; sprintf_s(posS, "pos: %8.3f %8.3f %8.3f", pos[0], pos[1], pos[2]); sprintf_s(fDirS, "facing: %8.3f %8.3f %8.3f", fDir[0], fDir[1], fDir[2]); sprintf_s(uDirS, "up: %8.3f %8.3f %8.3f", uDir[0], uDir[1], uDir[2]); char sCameraAngle[256], sMousePosX[256], sMousePosY[256]; sprintf_s(sCameraAngle, "camera angle: %8.3f", fCameraAngle); sprintf_s(sMousePosX, "mouse X %d ", mouseInput.mousePosX); sprintf_s(sMousePosY, "mouse Y %d ", mouseInput.mousePosY); text.Write(sCameraAngle, 20, 35, 255, 255, 0); text.Write(sMousePosX, 20, 50, 255, 255, 0); text.Write(sMousePosY, 20, 65, 255, 255, 0); text.Write(posS, 20, 80, 255, 255, 0); text.Write(fDirS, 20, 95, 255, 255, 0); text.Write(uDirS, 20, 110, 255, 255, 0); FnCharacter actor; actor.ID(actorID); //get actor's data actor.GetPosition(pos); actor.GetDirection(fDir, uDir); sprintf_s(posS, "pos: %8.3f %8.3f %8.3f", pos[0], pos[1], pos[2]); sprintf_s(fDirS, "facing: %8.3f %8.3f %8.3f", fDir[0], fDir[1], fDir[2]); sprintf_s(uDirS, "up: %8.3f %8.3f %8.3f", uDir[0], uDir[1], uDir[2]); text.Write(posS, 20, 125, 255, 255, 0); text.Write(fDirS, 20, 140, 255, 255, 0); text.Write(uDirS, 20, 155, 255, 255, 0); text.End(); sprintf_s(posS, "HEALTH"); charactorInfo.Write(posS, 50, 700, 255, 255, 100); sprintf_s(posS, "ROUND"); charactorInfo.Write(posS, 400, 700, 255, 255, 100); sprintf_s(posS, "TIME"); charactorInfo.Write(posS, 515, 700, 255, 255, 100); charactorInfo.End(); sprintf_s(posS, "%d", chrMgtSystem.getCharacterblood(actorID)); char_HP.Write(posS, 110, 672, 255, 255, 255); sprintf_s(posS, "%d", game_timer.getCurrentRound()); info.Write(posS, 460, 694 ,255, 255, 255); sprintf_s(posS, "%d", game_timer.getTimeLeft()); info.Write(posS, 560, 694, 255, 255, 255); info.End(); FySwapBuffers(); }