void RFrame_Render() { if (!RIsActive() && RIsFullScreen()) return; RRESULT isOK=RIsReadyToRender(); if(isOK==R_NOTREADY) return; else if(isOK==R_RESTORED) { RMODEPARAMS ModeParams={ RGetScreenWidth(),RGetScreenHeight(),RIsFullScreen(),RGetPixelFormat() }; RResetDevice(&ModeParams); cclog("devices Restored. \n"); } if(timeGetTime() > g_last_mouse_move_time + RTOOLTIP_GAP) g_tool_tip = true; if(g_pFunctions[RF_RENDER]) g_pFunctions[RF_RENDER](NULL); RGetDevice()->SetStreamSource(0,NULL,0,0); RGetDevice()->SetIndices(0); RGetDevice()->SetTexture(0,NULL); RGetDevice()->SetTexture(1,NULL); // Draw FPS // 60fps 가 100점 /* char buf[256]; float fMs = 1000.f/g_fFPS; float fScore = 100-(fMs-(1000.f/60.f))*2; sprintf(buf, "FPS : %3.3f , %d triangles, %4.1f ms,score %4.1f 점",g_fFPS,gNumTrisRendered,fMs,fScore); RECT drawRect; SetRect(&drawRect, 0, 0, RGetScreenWidth(), RGetScreenHeight()); g_lpFont->DrawText(buf, -1, &drawRect, DT_LEFT | DT_TOP, D3DCOLOR_RGBA(255, 255, 255, 255)); // */ /* for(int i=0;i<CCGetLogHistoryCount();i++) { drawRect.top=(i+1)*20; g_lpFont->DrawText(CCGetLogHistory(i), -1, &drawRect, DT_LEFT | DT_TOP, D3DCOLOR_RGBA(255, 255, 255, 255)); } */ }
RRESULT OnRender(void *pParam) { __BP(101, "main::OnRender"); if( !RIsActive() && RIsFullScreen() ) { __EP(101); return R_NOTREADY; } g_App.OnDraw(); #ifdef _SMOOTHLOOP Sleep(10); #endif #ifndef _PUBLISH if(g_pDefFont) { static char __buffer[256]; float fMs = 1000.f/g_fFPS; float fScore = 100-(fMs-(1000.f/60.f))*2; sprintf(__buffer, "GAME_STATE: %d FPS : %3.3f %.3f점 (%.3f ms)", ZGetGameInterface()->GetState(),g_fFPS,fScore,fMs); g_pDefFont->m_Font.DrawText( CCGetWorkspaceWidth()-400,0,__buffer ); // OutputDebugString(__buffer); } #endif __EP(101); return R_OK; }
RRESULT OnRender(void *pParam) { if( !RIsActive() && RIsFullScreen() ) { return R_NOTREADY; } g_Mint.Draw(); return R_OK; }
void RFrame_ToggleFullScreen() { RMODEPARAMS ModeParams={ RGetScreenWidth(),RGetScreenHeight(),RIsFullScreen(),RGetPixelFormat() }; if(!ModeParams.bFullScreen) // 윈도우 -> 풀스크린일때 저장하고.. GetWindowRect(g_hWnd,&g_rcWindowBounds); ModeParams.bFullScreen=!ModeParams.bFullScreen; RResetDevice(&ModeParams); if(!ModeParams.bFullScreen) // 풀스크린 -> 윈도우로 갈때 복구한다. { SetWindowPos( g_hWnd, HWND_NOTOPMOST, g_rcWindowBounds.left, g_rcWindowBounds.top, ( g_rcWindowBounds.right - g_rcWindowBounds.left ), ( g_rcWindowBounds.bottom - g_rcWindowBounds.top ), SWP_SHOWWINDOW ); } }
long FAR PASCAL WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { // Handle messages switch (message) { #ifndef _PUBLISH case WM_SYSCHAR: if(wParam==VK_RETURN) RFrame_ToggleFullScreen(); return 0; #endif case WM_SYSCOMMAND: { switch (wParam) { // Trap ALT so it doesn't pause the app case SC_PREVWINDOW : case SC_NEXTWINDOW : case SC_KEYMENU : { return 0; } break; } } break; case WM_ACTIVATEAPP: { if (wParam == TRUE) { if (g_pFunctions[RF_ACTIVATE]) g_pFunctions[RF_ACTIVATE](NULL); g_bActive = TRUE; } else { if (g_pFunctions[RF_DEACTIVATE]) g_pFunctions[RF_DEACTIVATE](NULL); if (RIsFullScreen()) { ShowWindow(hWnd, SW_MINIMIZE); UpdateWindow(hWnd); } g_bActive = FALSE; } } break; case WM_MOUSEMOVE: { g_last_mouse_move_time = timeGetTime(); g_tool_tip = false; } break; case WM_CLOSE: { RFrame_Destroy(); PostQuitMessage(0); return 0; } break; } return g_WinProc(hWnd, message, wParam, lParam); }