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
Update screen
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Update screen
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
Hi,
I guess that isn't implemented yet. In the Game Academy you have the base stack to start from.
Salut,
Josep M
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
correct script with variables declared two comments down.\/
Last edited by treefolk on Sat Jul 20, 2013 10:39 pm, edited 1 time in total.
Re: Update screen
Terrific!
This is great. This will really save me some time and effort.
Thanks.
Max
This is great. This will really save me some time and effort.
Thanks.
Max
Re: Update screen
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
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