Click here to Skip to main content
16,005,141 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A better Sleep() function Pin
Waldermort30-Nov-06 7:04
Waldermort30-Nov-06 7:04 
GeneralRe: A better Sleep() function Pin
Nibu babu thomas30-Nov-06 16:17
Nibu babu thomas30-Nov-06 16:17 
GeneralRe: A better Sleep() function Pin
Johpoke30-Nov-06 7:23
Johpoke30-Nov-06 7:23 
GeneralRe: A better Sleep() function Pin
Blake Miller30-Nov-06 8:10
Blake Miller30-Nov-06 8:10 
GeneralRe: A better Sleep() function Pin
Johpoke30-Nov-06 8:44
Johpoke30-Nov-06 8:44 
GeneralRe: A better Sleep() function Pin
Waldermort30-Nov-06 8:56
Waldermort30-Nov-06 8:56 
GeneralRe: A better Sleep() function Pin
Blake Miller30-Nov-06 8:58
Blake Miller30-Nov-06 8:58 
GeneralRe: A better Sleep() function Pin
Waldermort30-Nov-06 9:29
Waldermort30-Nov-06 9:29 
Just to make sure we are on the same wavelength here, you do know that all the sleep(1) call is doing is releasing CPU cycles to other processes. If you look at your app in the task manager it will still be hitting the 80-90% which is a bad thing really. You really shouldn't be using a loop for such a lengthy process.

Drawing a single scene of your animation takes a split second, you only need to draw that to the screen about 30 times a second ( less if the animation doesn't change often ). You should work out how often you need to draw a new scene and set a timer for that value. Handle the WM_TIMER to draw the scene but do not draw it to the screne. Instead, create a counter. So for example if you draw a scene 100 times a second, each time increase your counter, when the counter is 30/100 bitblt to the screen then reset the counter.

You may also find that using SetPixel() is incredibly slow. It may be a better idea to use a DIB and manipulate the pixels directly. Also to further increase your speed, create an offscreen bitmap to the same resolution as the screen.
QuestionRenaming files and folders [modified] Pin
kiranin30-Nov-06 4:20
kiranin30-Nov-06 4:20 
AnswerRe: Renaming files and folders Pin
CPallini30-Nov-06 4:26
mveCPallini30-Nov-06 4:26 
GeneralRe: Renaming files and folders Pin
Mark Salsbery30-Nov-06 5:53
Mark Salsbery30-Nov-06 5:53 
AnswerRe: Renaming files and folders Pin
David Crow30-Nov-06 4:55
David Crow30-Nov-06 4:55 
Questionhow to scan and list the opened windows from the taskbar Pin
kiranin30-Nov-06 4:07
kiranin30-Nov-06 4:07 
AnswerRe: how to scan and list the opened windows from the taskbar Pin
toxcct30-Nov-06 4:11
toxcct30-Nov-06 4:11 
QuestionLink library Pin
weehau30-Nov-06 3:11
weehau30-Nov-06 3:11 
AnswerRe: Link library Pin
toxcct30-Nov-06 3:16
toxcct30-Nov-06 3:16 
GeneralRe: Link library Pin
weehau30-Nov-06 3:32
weehau30-Nov-06 3:32 
GeneralRe: Link library Pin
toxcct30-Nov-06 3:47
toxcct30-Nov-06 3:47 
AnswerRe: Link library Pin
zoid ! 30-Nov-06 4:25
zoid ! 30-Nov-06 4:25 
QuestionAuto-Resize a CListCtrl in CFormView Pin
User 260927630-Nov-06 3:07
User 260927630-Nov-06 3:07 
AnswerRe: Auto-Resize a CListCtrl in CFormView Pin
Galatei30-Nov-06 3:52
Galatei30-Nov-06 3:52 
GeneralRe: Auto-Resize a CListCtrl in CFormView Pin
James R. Twine30-Nov-06 5:04
James R. Twine30-Nov-06 5:04 
AnswerRe: Auto-Resize a CListCtrl in CFormView Pin
David Crow30-Nov-06 4:00
David Crow30-Nov-06 4:00 
GeneralRe: Auto-Resize a CListCtrl in CFormView Pin
User 260927630-Nov-06 23:45
User 260927630-Nov-06 23:45 
QuestionPass structure using sockets Pin
OyeDec30-Nov-06 2:56
OyeDec30-Nov-06 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.