![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
To simulate a walking dog, I made use of forelayer and image lib (drawer) to erase last area then draw image on new position again. The transparency and partial refresh work fine.
However, the refresh speed is slow that I feel my the image is jumpping. Any way to draw image and refresh faster? I am using Dopod D810 WM6, CPU Samsung (R) 2442 with 400Mhz. The timer interval is set to 1 already. Thanks in advance.. ![]()
__________________
Yours, ![]() Dopod D810 WM6 GPS HSDPA 3G Wifi Bluetooth |
|
|||
|
Attached the little lengthy code. I used image and form lib.
It is fast enough when run on PC but slow on PPC. Here is the key code: sub repaint ' handle mapwin move if mapwin.moved = 1 then 'erase all sp for ii = 0 to spcnt - 1 sphide(ii) next ' redraw mapwin mapwin.x = min(bmpmap.Width - mapwin.w, max(0, mapwin.x + mapwin.dx) ) mapwin.y = min(bmpmap.Height - mapwin.h, max(0, mapwin.y + mapwin.dy) ) rectsrc.x = mapwin.x rectsrc.Y = mapwin.y rectsrc.Width = mapwin.w rectsrc.Height = mapwin.h rectdst.X = mapscr.x rectdst.y = mapscr.y rectdst.width = mapscr.w rectdst.height = mapscr.h drawerb.DrawImage1(bmpmap.Value, rectsrc.Value, rectdst.Value, true) drawerb.Refresh2(rectdst.Value) mapwin.moved = 0 mapwin.dx = 0 mapwin.dy = 0 form1.Line(10, 10, 60, 60, cRed, B) for ii = 0 to spcnt - 1 spshow(ii) next end if ' handle sp move for ii = 0 to spcnt - 1 if spmap(ii).moved = 1 and ii <> spselected then spmove(ii) end if next end sub sub spshow(nsp) if spinwin(nsp) then rectsrcs.X = 50 * spmap(nsp).pg rectsrcs.Y = 0 rectsrcs.Width = spmap(nsp).w rectsrcs.Height = spmap(nsp).h rectdsts.X = scrx(spmap(nsp).x) rectdsts.Y = scry(spmap(nsp).y) rectdsts.Width = spmap(nsp).w rectdsts.Height = spmap(nsp).h drawerf.DrawImage1(bmpsprite.Value, rectsrcs.Value, rectdsts.Value, true) drawerf.Refresh2(rectdsts.Value) end if end sub sub sphide(nsp) 'erase original image on screen rectdsts.X = scrx(spmap(nsp).x) rectdsts.Y = scry(spmap(nsp).y) rectdsts.Width = spmap(nsp).w rectdsts.Height = spmap(nsp).h drawerf.fillrectangle(brushs.Value, rectdsts.Value) ' clear last sprite pos drawerf.Refresh2(rectdsts.Value) end sub sub spmove(nsp) ' always move towards x + dx, y + dy 'erase original image on screen sphide(nsp) 'move to new pos on bmpmap spmap(nsp).x = min(bmpmap.Width - spmap(nsp).w, max(0, spmap(nsp).x + spmap(nsp).dx)) spmap(nsp).y = min(bmpmap.Height - spmap(nsp).h, max(0, spmap(nsp).y + spmap(nsp).dy)) ' draw sp again spshow(nsp) spmap(nsp).moved = 0 spmap(nsp).dx = 0 spmap(nsp).dy = 0 if ptinrect(spmap(nsp).x, spmap(nsp).y, 10, 10, 60, 60) then if spmap(nsp).acc = 0 then spslide(nsp) end if end sub
__________________
Yours, ![]() Dopod D810 WM6 GPS HSDPA 3G Wifi Bluetooth |
|
||||
|
You can see this example for a simple moving image: http://www.basic4ppc.com/files/BouncingSmiley.zip
This example runs pretty smooth, however moving more images will be slower (like in your case). |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bad screen refresh with sound command | pmu5757 | Questions & Help Needed | 6 | 05-09-2008 09:53 PM |
| Creating code faster | pmu5757 | Basic4ppc Wishlist | 0 | 04-13-2008 12:33 PM |
| How to draw into a Panel? | BasicUser | Questions & Help Needed | 1 | 07-21-2007 07:28 AM |
| Help/tips to make this app run faster | J12345T | Questions & Help Needed | 3 | 07-10-2007 12:06 AM |
| No refresh on device | rosmalen | Bug Reports | 5 | 06-16-2007 10:10 PM |