simplify hysteresis logic
This commit is contained in:
parent
3265abacb4
commit
fe8e4fd9da
11
main.lua
11
main.lua
|
@ -17,8 +17,7 @@ function App.initialize_globals()
|
||||||
-- tests currently mostly clear their own state
|
-- tests currently mostly clear their own state
|
||||||
|
|
||||||
-- resize
|
-- resize
|
||||||
Last_resize_time = nil
|
Last_resize_time = App.getTime()
|
||||||
|
|
||||||
-- blinking cursor
|
-- blinking cursor
|
||||||
Cursor_time = 0
|
Cursor_time = 0
|
||||||
end
|
end
|
||||||
|
@ -141,12 +140,8 @@ end
|
||||||
function App.update(dt)
|
function App.update(dt)
|
||||||
Cursor_time = Cursor_time + dt
|
Cursor_time = Cursor_time + dt
|
||||||
-- some hysteresis while resizing
|
-- some hysteresis while resizing
|
||||||
if Last_resize_time then
|
if App.getTime() < Last_resize_time + 0.1 then
|
||||||
if App.getTime() - Last_resize_time < 0.1 then
|
return
|
||||||
return
|
|
||||||
else
|
|
||||||
Last_resize_time = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
edit.update(Editor_state, dt)
|
edit.update(Editor_state, dt)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue