Stack Script - copy the following into your "Stack" script: local sStartUpdateTime local sFrameRate local sUpdateMessageId on preOpenStack set the acceleratedRendering of this stack to true set the navigationArrows to false startUpdatingTheScreen 50 end preOpenStack on activateScreenUpdates pFrameRate if pFrameRate is empty then put 50 into pFrameRate stopUpdatingTheScreen startUpdatingTheScreen 50 end activateScreenUpdates on startUpdatingTheScreen pFrameRate put pFrameRate into sFrameRate put 0 into sStartUpdateTime send "dispatchUpdateScreen" to me in 0 millisecs put the result into sUpdateMessageId end startUpdatingTheScreen on stopUpdatingTheScreen if sUpdateMessageId is not empty then cancel sUpdateMessageId end if put empty into sUpdateMessageId end stopUpdatingTheScreen on dispatchUpdateScreen local tThisFrameTime put the long seconds into tThisFrameTime if sStartUpdateTime is 0 then put the long seconds into sStartUpdateTime end if lock screen dispatch "updateScreen" to this card with tThisFrameTime unlock screen local tTheTimeNow put the long seconds into tTheTimeNow local tNextFrameCount put round((tTheTimeNow - sStartUpdateTime) * sFrameRate + 0.5) into tNextFrameCount send "dispatchUpdateScreen" to me in (sStartUpdateTime + (tNextFrameCount * (1 / sFrameRate)) - tTheTimeNow) seconds put the result into sUpdateMessageId end dispatchUpdateScreen |
Home > Game Loops - Advanced >