Click here to Skip to main content
15,909,656 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: dll problem Pin
ramana.g28-Jul-08 18:33
ramana.g28-Jul-08 18:33 
GeneralRe: dll problem Pin
prithaa28-Jul-08 18:47
prithaa28-Jul-08 18:47 
GeneralRe: dll problem Pin
Nibu babu thomas28-Jul-08 21:48
Nibu babu thomas28-Jul-08 21:48 
AnswerRe: dll problem Pin
sashoalm28-Jul-08 20:54
sashoalm28-Jul-08 20:54 
GeneralRe: dll problem Pin
prithaa28-Jul-08 21:11
prithaa28-Jul-08 21:11 
GeneralRe: dll problem Pin
sashoalm28-Jul-08 22:46
sashoalm28-Jul-08 22:46 
AnswerRe: dll problem Pin
Mark Salsbery29-Jul-08 7:00
Mark Salsbery29-Jul-08 7:00 
QuestionOnDraw() & Timer animation problem Pin
ccaprani28-Jul-08 15:25
ccaprani28-Jul-08 15:25 
Hey guys,
I'd really appreciate any help you have to offer on this doozy of a problem:

I have a simulation process that I animate to screen using OnDraw() and CMemDC. I use a Timer with an Invalidate() call to call the OnDraw() funstion. In the OnDraw function the simulation is told to progress X number of steps - X being variable because it's important the user can speed the simulation up (real-time is waaaay too slow).

So here's the rub: if the timer is set to, say 50 ms (ie 20 frames per second - a reasonably slow animation rate) and the user requests say 5 simulation steps (each step representing say 100 ms of the real world), then the simulation process takes longer to exectue than 50 ms and we end up backing the message queue up so that the application fails to respond for quite some time.

I tried to do it by keeping a single simulation step per OnDraw call, and reduce the Timer interval, but with the resolution of the system clock this is limited to about 10 ms on my PC, so I only get about 10 x real world speed - still not enough.

I think the solution is to have the simulation and the animation operating seperately, with the animation *only* being called every 50 ms, but I don't know how to interrupt the running simulation. Plus, running the simulation at full speed means the program is not-reponsive and even further, if I could animate this, full speed may be too fast for the user - they need to be able to control the *Time Warp*.

I hope I've made this clear - apologies if not. I think this must be a common enough problem but I can't find anything on it really. If you've any suggestions I'd love to hear them!

Thanks in advance Big Grin | :-D
AnswerRe: OnDraw() & Timer animation problem Pin
Luc Pattyn28-Jul-08 16:23
sitebuilderLuc Pattyn28-Jul-08 16:23 
GeneralRe: OnDraw() & Timer animation problem Pin
ccaprani28-Jul-08 16:43
ccaprani28-Jul-08 16:43 
GeneralRe: OnDraw() & Timer animation problem Pin
Luc Pattyn28-Jul-08 17:08
sitebuilderLuc Pattyn28-Jul-08 17:08 
GeneralRe: OnDraw() & Timer animation problem Pin
ccaprani28-Jul-08 17:31
ccaprani28-Jul-08 17:31 
GeneralRe: OnDraw() & Timer animation problem Pin
Luc Pattyn28-Jul-08 17:38
sitebuilderLuc Pattyn28-Jul-08 17:38 
GeneralRe: OnDraw() & Timer animation problem Pin
ccaprani28-Jul-08 17:40
ccaprani28-Jul-08 17:40 
AnswerRe: OnDraw() & Timer animation problem Pin
ccaprani28-Jul-08 18:50
ccaprani28-Jul-08 18:50 
QuestionHow to pass a wstring value to a string pointer [modified] Pin
monsieur_jj28-Jul-08 15:06
monsieur_jj28-Jul-08 15:06 
AnswerRe: How to pass a wstring value to a string pointer Pin
Mark Salsbery28-Jul-08 16:14
Mark Salsbery28-Jul-08 16:14 
AnswerRe: How to pass a wstring value to a string pointer Pin
Jijo.Raj28-Jul-08 17:16
Jijo.Raj28-Jul-08 17:16 
QuestionOwnerdraw a Dialog Pin
KellyR28-Jul-08 13:32
KellyR28-Jul-08 13:32 
AnswerRe: Ownerdraw a Dialog Pin
Stephen Hewitt28-Jul-08 14:21
Stephen Hewitt28-Jul-08 14:21 
QuestionRe: Ownerdraw a Dialog [modified] Pin
KellyR28-Jul-08 14:59
KellyR28-Jul-08 14:59 
AnswerRe: Ownerdraw a Dialog Pin
Stephen Hewitt28-Jul-08 15:09
Stephen Hewitt28-Jul-08 15:09 
AnswerRe: Ownerdraw a Dialog Pin
KellyR28-Jul-08 15:23
KellyR28-Jul-08 15:23 
QuestionEfficient Object Management Pin
Ehsan Baghaki28-Jul-08 10:39
Ehsan Baghaki28-Jul-08 10:39 
AnswerRe: Efficient Object Management Pin
Cedric Moonen28-Jul-08 20:27
Cedric Moonen28-Jul-08 20:27 

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.