I am making a program where snow falls from the sky. Each snow-bit is a pixel. Pixels on the floor stand there forever.
I use a matrix to store pixels on the floor, so each frame all floor-pixels are drawn (tested with SETPIXEX and DRAWSPRITE, no speed differences).
The problem is that when there is a lot (and I mean around 5000) pixels "dying in the sun", the game go sloooooow on iphone.
I did this program decades ago on my Amiga (in assembler!) and I did paint the pixels directly on the front buffer, so no extra-drawn per frame was necessary.
is there a way to paint directly in the frontbuffer in GLB?
If not, another solution is to do a USEASBMP each fps. Will be GLB4iphone enough fast? Only in vertical? (I am making it horizontal).
Someone gets and idea about how to do that?
Thx guys.
(on my PC I got 500 fps, on iphone 10-15)
You can use USESCREEN to save permanent (settled) snowflakes/sprites to, then display that screen as the background. I'm doing something similar in my current iPhod project.
Don't forget you need to create a virtualscreen first with CREATESCREEN #,Sprite#,width,height.
Are you working on an app for Christmas by any chance?
Not, it was just a quick/dirty app for the appstore, just to try how many units at $1 can I sell :nana:
In fact, it is not snow but sand... well, colored pixels. It is named "Sandscape"
Would love to save images to camera-roll...
Then it should be something like this?
createscreen 0,sp,480,320
repeat
usescreen 0
draw new background sand //sand that touch the floor after falling...
usescreen -1
drawsprite sp,0,0
draw falling sand
showscreen
forever
Yep. :)
for sand, why not calculate the pixel ina DIM and use MEM2SPRITE?