While at the conference I found time to figure out a couple of things. I used arrays for the first time (in LiveCode that is), and I found hardware acceleration settings that worked well.
The test I did was to have a scene doing parallax scrolling. The initial scene is made up of five slices, each 1024 wide, and significantly tall too. Those need to be on the card twice each, so that you can scroll the second copy into view as you move. That went well enough, so I added 101 LC logos to the scene, and it still moved well. I made changes now so that you can try the effect on desktop, not just on mobile. If you do build this to mobile it uses the accelerometer, otherwise it uses the mouse position to control the scrolling speed. Here's a zip file of the stack: http://xfiles.funnygarbage.com/~colinholgate/rev/scrolling.zip The stack script is this: on preopenstack if the environment is mobile then iphoneSetRedrawInterval 1 set the compositorType of this stack to "OpenGL" set the compositorTileSize of this stack to 64 set the compositorCacheLimit of this stack to 1024*1024*128 end if end preopenstack You are able to just turn on the acceleratedRendering of stack, but I wanted to have higher cache limits than the defaults. The only other script is in the card, and some of the script only ever had to run once, to generate 100 of the LC logos. Here's the card script: global places,worldx,difx on opencard resetobjects put 0 into difx if the environment is mobile then mobileEnableAccelerometer 100 moveworld end opencard on accelerationChanged pXAccel, pYAccel, pZAccel put min(100,max(-100,pYAccel*10)) into difx end accelerationChanged on moveworld if the environment is not mobile then put (512-the mouseh)/100 into difx end if movethings difx send moveworld to me in 16 milliseconds end moveworld on resetobjects lock screen put 0 into oldvalue put 0 into worldx put "" into places split places by return addimage "lc1",the left of img "lc1",8 repeat with a = 1 to 100 put "lc_"&a into imagename if there is not an image imagename then clone image "lc1" set the name of image the number of images to imagename end if set the width of image imagename to min(256,1024/min(101-a,100)) set the height of image imagename to min(256,1024/min(101-a,100)) set the top of image imagename to random(500) set the left of image imagename to random(2048) addimage imagename,the left of image imagename,min(10+(101-a) / 3,100) end repeat addimage "sky1",0,60 addimage "sky2",1024,60 addimage "hills1",0,40 addimage "hills2",1024,40 addimage "tracks1",0,20 addimage "tracks2",1024,20 addimage "farhedges1",0,10 addimage "farhedges2",1024,10 addimage "nearhedges1",0,5 addimage "nearhedges2",1024,5 movethings worldx repeat with a = 1 to the number of images set the layerMode of img a to dynamic end repeat unlock screen end resetobjects on addimage imagename, imageplace, imagespeed put imagename into places[imagename]["imagename"] put imageplace into places[imagename]["imageplace"] put imagespeed into places[imagename]["imagespeed"] end addimage on movethings howmuch lock screen repeat for each element a in places put a["imagename"] into imagename put a["imageplace"] +howmuch*100/a["imagespeed"] into newloc if newloc >= 1024 then subtract 2048 from newloc else if newloc < -1024 then add 2048 to newloc end if end if put newloc into places[imagename]["imageplace"] set the left of image imagename to trunc(newloc) end repeat unlock screen end movethings That worldx value ended up not being needed. One thing about arrays I learned was that when you get an element of an array it's copy of that element, not a reference to it. My plan was to set the property in the element reference, and to expect that to immediately change the original value in the array. Turns out that it doesn't work that way, hence the line: put newloc into places[imagename]["imageplace"] _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode