|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I'm using Win32 API. And when I run the application, the CPU load is loud. And I was wondering how do I get it not be so loud. Heres the loop. Oh its not loud when it's visible, but when you minimize it or put it behind another window that covers it, its loud.
Code:
if(SUCCEEDED(initD3D(hWnd)))
{
if(SUCCEEDED(init_graphics()))
{
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
MSG msg;
ZeroMemory(&msg, sizeof(MSG));
while(msg.message != WM_QUIT)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
render_frame();
// check the 'escape' key
//if(KEY_DOWN(VK_ESCAPE))
//PostMessage(hWnd, WM_DESTROY, 0, 0);
}
// clean up DirectX and COM
cleanD3D();
}
}
__________________
[img] http://r2.fodey.com/1922b06d7e4284cce9657003fdf330220.1.gif [/img] ![]() ![]() ![]() ![]() ![]() ![]()
|
|
#2
|
|||
|
|||
|
Sorry, I'm not familiar with Win32API but...
... I think you're rendering too many frames ... okey I will cut the jokes. Basicly you have the inner while loop without any 'sleeping', if you stop rendering the scene when the window is minimized, it will cycle like a fury - causing the processor to heat up. If I'm mistaken due to my lack of knowledge, I'm sorry... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Game Development > CPU Load High |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|