DirectDraw Blt slowing down windows?

Started by
10 comments, last by stranger4u 21 years, 8 months ago
It''s really frustrating when you''re new to game programming and then at the very beginning something like this happens for no reason (at least no reason you would think of). Something like that happened before and I gave up on game programming. Maybe this time I''ll have more luck and go through with it.
Advertisement
It''s not so much something that is game-programming specific but is a more general thing in a co-operative environment. You''ve got to remember that there are other programs running at the same time as yours, and you''ve got to respect that especially if you''re running in window-ed mode.

The Windows scheduler will allocate time on the CPU for each thread of execution running, but for this to work effectively you still need to be careful to make sure that you''re not hogging the CPU. Obviously in a game, you want to hog the CPU as much as you can, so you need to strike a balance between hogging the CPU, and letting other threads run.

Calling Sleep(0) just indicates to Windows that you are prepared to give up the remainder of your current time-slice on the CPU to whatever else wants to run. This is usually enough to keep Windows looking reasonable, anything else that needs a lot of time on the CPU will be given it.

JJ.

This topic is closed to new replies.

Advertisement