I thought I detected a stutter in DeltaTime
when beta testing Codea, and wrote the code below to examine it (DeltaTime
) graphically. Try changing the size of the Output pane while it is running.
--
-- FPS Plotter
--
supportedOrientations(LANDSCAPE_ANY)
backingMode(RETAINED)
function setup()
maxDeltaTime = 1/60
odt = 1
dim = math.min(WIDTH, HEIGHT) * 0.5
ox = (WIDTH - dim)/2
oy = (HEIGHT - dim)/2
background(0)
strokeWidth(5)
stroke(0, 127, 0)
noFill()
line(0, oy + dim/2, WIDTH, oy + dim/2)
line(ox + dim/2, 0, ox + dim/2, HEIGHT)
rect(ox, oy, dim, dim)
fill(0, 255, 0)
text("0, 0", ox - 10, oy - 10)
text("30, 0", ox + dim/2, oy - 10)
text("60, 0", ox + dim + 10, oy - 10)
text("0, 30", ox - 30, oy + dim/2)
text("60, 30", ox + dim + 30, oy + dim/2)
text("0, 60", ox - 10, oy + dim + 10)
text("30, 60", ox + dim/2, oy + dim + 10)
text("60, 60", ox + dim + 10, oy + dim + 10)
fill(255, 64)
noStroke()
end
function draw()
dt = maxDeltaTime/DeltaTime
-- print(dt) -- Uncomment to see effect of print in draw()
ellipse(ox + dim * dt, oy + dim * odt, 10)
odt = dt
end