|
Hi Gajo,
First of all, continuously calling Move(...)
without doing some sort of Sleep just sounds wrong, because you're never giving
windows a chance to do anything.
My approach, if using threads, would be as follows.
The application's main thread (AMT) starts the bitmap management thread
(BMT).
The BMT maintains a list of objects with their x and y coordinates, the
angle, and the next tick count at which they will be drawn. Be careful
about using GetTickCount because simply adding a number to the value returned
may result in an overflow.
The BMT enters a processing loop that checks and processes any messages,
and then scans the list of objects to see if any need to be redrawn. For
each object that needs to be redrawn, the BMT sends a message (via
PostThreadMessage) to the AMT and then marks that object as not to be modified
until a confirmation message is received from the AMT. The pointer to the
object can be passed within the PostThreadMessage call.
When the AMT receives a draw message from the BMT, it draws the object that
has been passed in and then sends a message back to the BMT to indicate that the
drawing has been completed - this avoids any problems with the BMT trying to
update an object while the AMT is trying to draw it.
When the BMT is terminated, it needs to free up all memory for all objects
created.
I hope this is enough information to get you started - it's only a rough
plan, but the concept should work.
Feel free to mail me privately if you have any questions.
Regards, Bevan
---
Bevan Edwards mailto:[EMAIL PROTECTED] Achieve Software Limited http://www.achieve.co.nz Phone: (64-9) 444-4210 ICQ: 732011 Fax: (64-9) 444-4201 Mobile: (64-21) 979-603 |
_______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
