Pause
This function pauses the application time until Leadwerks::Time::Resume() is called. When the time is updated with a call to Leadwerks::Time::Update(), the time spent in the paused state will be subtracted from the time elapsed.
Syntax
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
model = Model:Box()
model:SetColor(0.0,0.0,1.0)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
--Press the space key pause and resume timing
if (window:KeyHit(Key.Space)) then
paused = not paused
if (paused) then
Time:Pause()
else
Time:Resume()
end
end
model:Turn(0,Time:GetSpeed(),0)
Time:Update()
world:Update()
world:Render()
context:SetBlendMode(Blend.Alpha)
context:DrawText("Time: "..Time:GetCurrent(),2,2)
context:DrawText("Millisecs: "..Time:Millisecs(),2,22)
context:Sync()
end