Skip to main content
GameDev.net gamedev.net
🔒 Locked

Very basic question about first tutorial

Started by roel_v May 13, 2003 at 12:10 PM 1 replies 400+ views
Original Post
roel_v
roel_v
Hello all, I have a very basic question. The first tutorial''s message loop looks like this: if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) using the non-blocking PeekMessage(), not GetMessage(). Now why-o-why doesn''t the program use 100% cpu when I run it? The whole loop looks like while(1) {DoSomething();} but it is obviously blocking somewhere; but where? Thanks! cheers, roel
xiros
xiros
just going through an empty loop the program will use maximum cpu power. Try calling sleep() i think it makes the program just wait without using any cpu power for the specified ammount of tiem.
roel_v
roel_v
I think I mis-phrased my question. The code in the first tutorial works, and it doesn''t use 100% cpu; but I was wondering why not. The way I see it, it should be in a continuous loop, but it isn''t; one of the call in the while() loop must be blocking, but I don''t know which one. Related to this question is a question about the fourth tutorial (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=05, the one with the spinning triangle and quad): why is it rotating? Why is the routine that does the drawing called more than once? And what controls the rate at which the routine is called? I suspect that my original question and this one are related; thanks for all insights!

cheers,

roel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.