Game Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesGame Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 24th, 2007, 08:59 AM
Kiryn's Avatar
Kiryn Kiryn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: Houston, Texas, USA
Posts: 393 Kiryn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 49 m 27 sec
Reputation Power: 3
Send a message via AIM to Kiryn Send a message via MSN to Kiryn Send a message via Yahoo to Kiryn
Unhappy CPU Load High

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]







Reply With Quote
  #2  
Old August 16th, 2007, 04:35 PM
Kefik Kefik is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 8 Kefik User rank is Sergeant (500 - 2000 Reputation Level)Kefik User rank is Sergeant (500 - 2000 Reputation Level)Kefik User rank is Sergeant (500 - 2000 Reputation Level)Kefik User rank is Sergeant (500 - 2000 Reputation Level)Kefik User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 h 12 m 23 sec
Reputation Power: 0
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...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesGame Development > CPU Load High


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway