Get on offscreen drawing

Posted by ALB42 on 6. März 2015No Comments

Magorium send me a link to a pacman clone for freepascal which does not work on AROS currently. I tried to find out whats wrong with it. First it was only the offscreen painting problem which I tried to overcome. But then I noticed how bad this program is, when talking about programming style. The whole drawing is done outside the paint events, which leads to a very bad performance on widgets which does not support drawing outside Paint events (like the MUI interface) because for every draw call the whole widget is called to repaint. The whole process is just paint driven so if you computer is slower it become easier to solve because all items move slower.
I changed it to a paint event driven painting and it work, faster but still very slow.

lacman-1

Of course this is still not a good method, a better approach would be to collect the static pieces into an Bitmap and then draw it at once to the screen in Paint event, and then only paint the Ghosts and the Pac Man to the screen.
An eating of Points/pills and so on would lead to change of the TBitmap. But there only one piece is redrawn. Maybe then it would be come much faster.
But there again one would need an offscreen drawing method, which is possible already, but no chance to plot it to screen. I’m still working on the concept for it but seems I still didn’t find a way. Still fighting with keys and mouse events but at least the pacman clone work now.
Still no interrest on freepascal on AROS, seems my programs didn’t help.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert