Page 1 of 1
Update screen
Posted: Sat Feb 02, 2013 12:11 pm
by maxs
Has Updatescreen been implemented in Livecode? I did not see it in the dictionary. Do I need to hunt done the code to paste into the stack script?
Max
Re: Update screen
Posted: Sat Feb 02, 2013 4:41 pm
by sturgis
Will need to hunt it down. If you have trouble finding it post here again and I'll start digging through my stuff to locate it.
Re: Update screen
Posted: Fri Apr 26, 2013 7:06 am
by JosepM
Hi,
I guess that isn't implemented yet. In the Game Academy you have the base stack to start from.
Salut,
Josep M
Re: Update screen
Posted: Mon Jul 01, 2013 7:20 pm
by treefolk
correct script with variables declared two comments down.\/
Re: Update screen
Posted: Tue Jul 02, 2013 10:40 am
by maxs
Terrific!
This is great. This will really save me some time and effort.
Thanks.
Max
Re: Update screen
Posted: Tue Jul 02, 2013 8:20 pm
by treefolk
Hey, It looks to me like i left some of the code out, so here is the full update screen script:
local sStartUpdateTime
local sFrameRate
local sUpdateMessageId
on preOpenStack
set the acceleratedRendering of this stack to true
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
sorry for the double post, didn't wanna confuse anybody.
--treefolk