GetCurrent
This function gets the current application time. The application time is updated with each call to Leadwerks::Time::Update() and will be modified by calls to Leadwerks::Time::Pause() and Leadwerks::Time::Resume(). Therefore, expect this function to return a different value than Leadwerks::Time::Millisecs().
Syntax
Returns
Returns the current application time.
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