Got any advice on how I can improve the performance of my game? I just plugged all my drawing and updating functions inside the ProcessNextFrame loop and my FPS dropped to 20-24 FPS. Are there any tips or techniques I should observe to make it work faster? (graphical, computational considerations?) Any help would really be appreciated. :-)
- Code:
HRESULT CMyApplication::ProcessNextFrame(CGapiSurface& backbuffer, DWORD dwFlags)
{
RECT rect;
GDFILLRECTFX rectfx;
TCHAR str[128];
FLOAT nActualFrameTime = 0;
FLOAT nFrameRate = 0;
DWORD dwScreenWidth = backbuffer.GetWidth();
DWORD dwScreenHeight = backbuffer.GetHeight();
switch(fi_WindowState)
{
case MAIN_GAME:
//draw stuff
DrawStuff1(backbuffer, fi_CurRegion);
DrawStuff2(backbuffer, fi_CurRegion);
DrawStuff3(backbuffer, fi_CurRegion);
DrawStuff4(backbuffer, fi_CurRegion);
DrawStuff5(backbuffer, fi_CurRegion);
DrawStuff6(backbuffer, fi_CurRegion);
//update stuff
UpdateStuff1(fi_CurRegion);
UpdateStuff2(fi_CurRegion);
UpdateStuff3();
UpdateStuff4();
break;
}
m_timer.GetActualFrameRate(&nFrameRate);
_stprintf(str, TEXT("Current framerate: [%.3f fps]"), nFrameRate);
DrawFrameInfo(backbuffer, dwScreenHeight - 315, str, RGB(90, 60, 170));
return S_OK;
}