I'm implementing an animation controller in my editor and have run across several issues.
When the animation plays, the tiles that it displays will flicker in either the tile selection window or the view window if your mouse is in either one of them. I know this is due to the fact that my render for the windows is asking for the Tile DC at the same time the thread is asking for it. Perhaps a CSemaphore with a CSingleLock is in order?
I'm using AfxBeginThread() to create the thread. According to MFC docs, this thread object will be destroyed when the app exits. Why then is MSVC complaining about a leaked CWinThread object? Even if I get a pointer to this thread there is no way to stop the thread via CWinThread and I cannot use delete because it was not created with new. Suggestions?
Sharing DC's and getting this all to work across threads has been a royal pain.
The thread simlply updates the animation time counters and then draws the animations in the correct windows using that window's dc. I couldn't use OnIdle() because it didn't get called enough to make the animation of any use. The animation works perfect, just have some issues to sort out with synchronization and leaking the main thread.