Hi all,
I was recently asked how you would pause a timer on PM so I thought I'd share my reply as it may be useful for someone:
You just need to maintain a variable for your timer. Increment it each frame when not paused, and don't increment it when paused. Example:
// Project: pausetimer
// Created: 2016-02-24
// set window properties
SetWindowTitle( "pausetimer" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
do
if GetPointerState() <> 1
requiredtimer# = requiredtimer# + GetFrameTime()
endif
Print( "Click to pause timer: "+str(requiredtimer#))
Sync()
loop