draw.nv
· 3.0 KiB · Text
原始檔案
Playground
|#| constant, @sleep, 60
|#| constant, @pixel r, 255
|#| constant, @pixel g, 255
|#| constant, @pixel b, 255
|#| constant, clear old mouse x, 1000000
|#| constant, clear old mouse y, 1000000
|#| constant, current mouse x -> old mouse x, 1000000
|#| constant, current mouse y -> old mouse y, 1000000
|#| constant, @mouse x -> current mouse x, 1000000
|#| constant, @mouse y -> current mouse y, 1000000
|#| constant, copy old mouse x -> @line x1, 1000000
|#| constant, copy old mouse y -> @line y1, 1000000
|#| constant, copy current mouse x -> @line x2, 1000000
|#| constant, copy current mouse y -> @line y2, 1000000
|clear old mouse x, old mouse x| |clear old mouse x|
|clear old mouse y, old mouse y| |clear old mouse y|
|current mouse x -> old mouse x, current mouse x| old mouse x
|current mouse y -> old mouse y, current mouse y| old mouse y
|current mouse x -> old mouse x| |current mouse y -> old mouse y|
|@mouse x -> current mouse x, @mouse x| current mouse x
|@mouse y -> current mouse y, @mouse y| current mouse y
|@mouse x -> current mouse x| |@mouse y -> current mouse y|
|copy old mouse x -> @line x1, old mouse x|
, used old mouse x, @line x1
|copy old mouse y -> @line y1, old mouse y|
, used old mouse y, @line y1
|copy current mouse x -> @line x2, current mouse x|
, used current mouse x, @line x2
|copy current mouse y -> @line y2, current mouse y|
, used current mouse y, @line y2
|copy old mouse x -> @line x1| |copy old mouse y -> @line y1|
|copy current mouse x -> @line x2| |copy current mouse y -> @line y2|
|used old mouse x| old mouse x
|used old mouse y| old mouse y
|used current mouse x| current mouse x
|used current mouse y| current mouse y
|clear old mouse position|
, clear old mouse x:1000000
, clear old mouse y:1000000
|move current mouse position to old mouse position|
, current mouse x -> old mouse x:1000000
, current mouse y -> old mouse y:1000000
|move @mouse position to current mouse position|
, @mouse x -> current mouse x:1000000
, @mouse y -> current mouse y:1000000
|update mouse position|
, @mouse position
, clear old mouse position
, move current mouse position to old mouse position
, move @mouse position to current mouse position
|check if mouse button is down|
, @mouse is down
, @mouse button
|set line to white|
, @pixel r:255
, @pixel g:255
, @pixel b:255
|set line position|
, copy old mouse x -> @line x1:1000000
, copy old mouse y -> @line y1:1000000
, copy current mouse x -> @line x2:1000000
, copy current mouse y -> @line y2:1000000
|draw the line| @draw line
|draw a line, @mouse button is down|
, set line to white
, set line position
, draw the line
|draw a line|
|update|
, update mouse position
, check if mouse button is down
, draw a line
|poll inputs|
@poll inputs
|draw|
@display
|sleep|
@sleep:16
|main loop|
, poll inputs
, update
, draw
, sleep
, main loop
|| main loop
| 1 | |#| constant, @sleep, 60 |
| 2 | |#| constant, @pixel r, 255 |
| 3 | |#| constant, @pixel g, 255 |
| 4 | |#| constant, @pixel b, 255 |
| 5 | |#| constant, clear old mouse x, 1000000 |
| 6 | |#| constant, clear old mouse y, 1000000 |
| 7 | |#| constant, current mouse x -> old mouse x, 1000000 |
| 8 | |#| constant, current mouse y -> old mouse y, 1000000 |
| 9 | |#| constant, @mouse x -> current mouse x, 1000000 |
| 10 | |#| constant, @mouse y -> current mouse y, 1000000 |
| 11 | |#| constant, copy old mouse x -> @line x1, 1000000 |
| 12 | |#| constant, copy old mouse y -> @line y1, 1000000 |
| 13 | |#| constant, copy current mouse x -> @line x2, 1000000 |
| 14 | |#| constant, copy current mouse y -> @line y2, 1000000 |
| 15 | |
| 16 | |clear old mouse x, old mouse x| |clear old mouse x| |
| 17 | |clear old mouse y, old mouse y| |clear old mouse y| |
| 18 | |
| 19 | |current mouse x -> old mouse x, current mouse x| old mouse x |
| 20 | |current mouse y -> old mouse y, current mouse y| old mouse y |
| 21 | |
| 22 | |current mouse x -> old mouse x| |current mouse y -> old mouse y| |
| 23 | |
| 24 | |@mouse x -> current mouse x, @mouse x| current mouse x |
| 25 | |@mouse y -> current mouse y, @mouse y| current mouse y |
| 26 | |
| 27 | |@mouse x -> current mouse x| |@mouse y -> current mouse y| |
| 28 | |
| 29 | |copy old mouse x -> @line x1, old mouse x| |
| 30 | , used old mouse x, @line x1 |
| 31 | |
| 32 | |copy old mouse y -> @line y1, old mouse y| |
| 33 | , used old mouse y, @line y1 |
| 34 | |
| 35 | |copy current mouse x -> @line x2, current mouse x| |
| 36 | , used current mouse x, @line x2 |
| 37 | |
| 38 | |copy current mouse y -> @line y2, current mouse y| |
| 39 | , used current mouse y, @line y2 |
| 40 | |
| 41 | |copy old mouse x -> @line x1| |copy old mouse y -> @line y1| |
| 42 | |copy current mouse x -> @line x2| |copy current mouse y -> @line y2| |
| 43 | |
| 44 | |used old mouse x| old mouse x |
| 45 | |used old mouse y| old mouse y |
| 46 | |used current mouse x| current mouse x |
| 47 | |used current mouse y| current mouse y |
| 48 | |
| 49 | |clear old mouse position| |
| 50 | , clear old mouse x:1000000 |
| 51 | , clear old mouse y:1000000 |
| 52 | |
| 53 | |move current mouse position to old mouse position| |
| 54 | , current mouse x -> old mouse x:1000000 |
| 55 | , current mouse y -> old mouse y:1000000 |
| 56 | |
| 57 | |move @mouse position to current mouse position| |
| 58 | , @mouse x -> current mouse x:1000000 |
| 59 | , @mouse y -> current mouse y:1000000 |
| 60 | |
| 61 | |update mouse position| |
| 62 | , @mouse position |
| 63 | , clear old mouse position |
| 64 | , move current mouse position to old mouse position |
| 65 | , move @mouse position to current mouse position |
| 66 | |
| 67 | |check if mouse button is down| |
| 68 | , @mouse is down |
| 69 | , @mouse button |
| 70 | |
| 71 | |set line to white| |
| 72 | , @pixel r:255 |
| 73 | , @pixel g:255 |
| 74 | , @pixel b:255 |
| 75 | |
| 76 | |set line position| |
| 77 | , copy old mouse x -> @line x1:1000000 |
| 78 | , copy old mouse y -> @line y1:1000000 |
| 79 | , copy current mouse x -> @line x2:1000000 |
| 80 | , copy current mouse y -> @line y2:1000000 |
| 81 | |
| 82 | |draw the line| @draw line |
| 83 | |
| 84 | |draw a line, @mouse button is down| |
| 85 | , set line to white |
| 86 | , set line position |
| 87 | , draw the line |
| 88 | |
| 89 | |draw a line| |
| 90 | |
| 91 | |update| |
| 92 | , update mouse position |
| 93 | , check if mouse button is down |
| 94 | , draw a line |
| 95 | |
| 96 | |poll inputs| |
| 97 | @poll inputs |
| 98 | |
| 99 | |draw| |
| 100 | @display |
| 101 | |
| 102 | |sleep| |
| 103 | @sleep:16 |
| 104 | |
| 105 | |main loop| |
| 106 | , poll inputs |
| 107 | , update |
| 108 | , draw |
| 109 | , sleep |
| 110 | , main loop |
| 111 | |
| 112 | || main loop |
zz.draw.generated.lua
· 23 KiB · Lua
原始檔案
Playground
local min, max, huge = math.min, math.max, math.huge
return function(counters)
if counters["@sleep:60"] > 0 then
local acc = huge
acc = min(acc, counters["@sleep:60"])
counters["@sleep:60"] = max(counters["@sleep:60"] - acc, 0)
counters["@sleep"] = counters["@sleep"] + acc * 60
return true
elseif counters["@pixel r:255"] > 0 then
local acc = huge
acc = min(acc, counters["@pixel r:255"])
counters["@pixel r:255"] = max(counters["@pixel r:255"] - acc, 0)
counters["@pixel r"] = counters["@pixel r"] + acc * 255
return true
elseif counters["@pixel g:255"] > 0 then
local acc = huge
acc = min(acc, counters["@pixel g:255"])
counters["@pixel g:255"] = max(counters["@pixel g:255"] - acc, 0)
counters["@pixel g"] = counters["@pixel g"] + acc * 255
return true
elseif counters["@pixel b:255"] > 0 then
local acc = huge
acc = min(acc, counters["@pixel b:255"])
counters["@pixel b:255"] = max(counters["@pixel b:255"] - acc, 0)
counters["@pixel b"] = counters["@pixel b"] + acc * 255
return true
elseif counters["clear old mouse x:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["clear old mouse x:1000000"])
counters["clear old mouse x:1000000"] = max(counters["clear old mouse x:1000000"] - acc, 0)
counters["clear old mouse x"] = counters["clear old mouse x"] + acc * 1000000
return true
elseif counters["clear old mouse y:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["clear old mouse y:1000000"])
counters["clear old mouse y:1000000"] = max(counters["clear old mouse y:1000000"] - acc, 0)
counters["clear old mouse y"] = counters["clear old mouse y"] + acc * 1000000
return true
elseif counters["current mouse x -> old mouse x:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["current mouse x -> old mouse x:1000000"])
counters["current mouse x -> old mouse x:1000000"] = max(counters["current mouse x -> old mouse x:1000000"] - acc, 0)
counters["current mouse x -> old mouse x"] = counters["current mouse x -> old mouse x"] + acc * 1000000
return true
elseif counters["current mouse y -> old mouse y:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["current mouse y -> old mouse y:1000000"])
counters["current mouse y -> old mouse y:1000000"] = max(counters["current mouse y -> old mouse y:1000000"] - acc, 0)
counters["current mouse y -> old mouse y"] = counters["current mouse y -> old mouse y"] + acc * 1000000
return true
elseif counters["@mouse x -> current mouse x:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["@mouse x -> current mouse x:1000000"])
counters["@mouse x -> current mouse x:1000000"] = max(counters["@mouse x -> current mouse x:1000000"] - acc, 0)
counters["@mouse x -> current mouse x"] = counters["@mouse x -> current mouse x"] + acc * 1000000
return true
elseif counters["@mouse y -> current mouse y:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["@mouse y -> current mouse y:1000000"])
counters["@mouse y -> current mouse y:1000000"] = max(counters["@mouse y -> current mouse y:1000000"] - acc, 0)
counters["@mouse y -> current mouse y"] = counters["@mouse y -> current mouse y"] + acc * 1000000
return true
elseif counters["copy old mouse x -> @line x1:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["copy old mouse x -> @line x1:1000000"])
counters["copy old mouse x -> @line x1:1000000"] = max(counters["copy old mouse x -> @line x1:1000000"] - acc, 0)
counters["copy old mouse x -> @line x1"] = counters["copy old mouse x -> @line x1"] + acc * 1000000
return true
elseif counters["copy old mouse y -> @line y1:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["copy old mouse y -> @line y1:1000000"])
counters["copy old mouse y -> @line y1:1000000"] = max(counters["copy old mouse y -> @line y1:1000000"] - acc, 0)
counters["copy old mouse y -> @line y1"] = counters["copy old mouse y -> @line y1"] + acc * 1000000
return true
elseif counters["copy current mouse x -> @line x2:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["copy current mouse x -> @line x2:1000000"])
counters["copy current mouse x -> @line x2:1000000"] = max(counters["copy current mouse x -> @line x2:1000000"] - acc, 0)
counters["copy current mouse x -> @line x2"] = counters["copy current mouse x -> @line x2"] + acc * 1000000
return true
elseif counters["copy current mouse y -> @line y2:1000000"] > 0 then
local acc = huge
acc = min(acc, counters["copy current mouse y -> @line y2:1000000"])
counters["copy current mouse y -> @line y2:1000000"] = max(counters["copy current mouse y -> @line y2:1000000"] - acc, 0)
counters["copy current mouse y -> @line y2"] = counters["copy current mouse y -> @line y2"] + acc * 1000000
return true
elseif counters["clear old mouse x"] > 0 and counters["old mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["clear old mouse x"])
acc = min(acc, counters["old mouse x"])
counters["clear old mouse x"] = max(counters["clear old mouse x"] - acc, 0)
counters["old mouse x"] = max(counters["old mouse x"] - acc, 0)
return true
elseif counters["clear old mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["clear old mouse x"])
counters["clear old mouse x"] = max(counters["clear old mouse x"] - acc, 0)
return true
elseif counters["clear old mouse y"] > 0 and counters["old mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["old mouse y"])
acc = min(acc, counters["clear old mouse y"])
counters["clear old mouse y"] = max(counters["clear old mouse y"] - acc, 0)
counters["old mouse y"] = max(counters["old mouse y"] - acc, 0)
return true
elseif counters["clear old mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["clear old mouse y"])
counters["clear old mouse y"] = max(counters["clear old mouse y"] - acc, 0)
return true
elseif counters["current mouse x -> old mouse x"] > 0 and counters["current mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["current mouse x -> old mouse x"])
acc = min(acc, counters["current mouse x"])
counters["current mouse x -> old mouse x"] = max(counters["current mouse x -> old mouse x"] - acc, 0)
counters["current mouse x"] = max(counters["current mouse x"] - acc, 0)
counters["old mouse x"] = counters["old mouse x"] + acc * 1
return true
elseif counters["current mouse y -> old mouse y"] > 0 and counters["current mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["current mouse y"])
acc = min(acc, counters["current mouse y -> old mouse y"])
counters["current mouse y -> old mouse y"] = max(counters["current mouse y -> old mouse y"] - acc, 0)
counters["current mouse y"] = max(counters["current mouse y"] - acc, 0)
counters["old mouse y"] = counters["old mouse y"] + acc * 1
return true
elseif counters["current mouse x -> old mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["current mouse x -> old mouse x"])
counters["current mouse x -> old mouse x"] = max(counters["current mouse x -> old mouse x"] - acc, 0)
return true
elseif counters["current mouse y -> old mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["current mouse y -> old mouse y"])
counters["current mouse y -> old mouse y"] = max(counters["current mouse y -> old mouse y"] - acc, 0)
return true
elseif counters["@mouse x -> current mouse x"] > 0 and counters["@mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["@mouse x -> current mouse x"])
acc = min(acc, counters["@mouse x"])
counters["@mouse x -> current mouse x"] = max(counters["@mouse x -> current mouse x"] - acc, 0)
counters["@mouse x"] = max(counters["@mouse x"] - acc, 0)
counters["current mouse x"] = counters["current mouse x"] + acc * 1
return true
elseif counters["@mouse y -> current mouse y"] > 0 and counters["@mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["@mouse y"])
acc = min(acc, counters["@mouse y -> current mouse y"])
counters["@mouse y -> current mouse y"] = max(counters["@mouse y -> current mouse y"] - acc, 0)
counters["@mouse y"] = max(counters["@mouse y"] - acc, 0)
counters["current mouse y"] = counters["current mouse y"] + acc * 1
return true
elseif counters["@mouse x -> current mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["@mouse x -> current mouse x"])
counters["@mouse x -> current mouse x"] = max(counters["@mouse x -> current mouse x"] - acc, 0)
return true
elseif counters["@mouse y -> current mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["@mouse y -> current mouse y"])
counters["@mouse y -> current mouse y"] = max(counters["@mouse y -> current mouse y"] - acc, 0)
return true
elseif counters["copy old mouse x -> @line x1"] > 0 and counters["old mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["copy old mouse x -> @line x1"])
acc = min(acc, counters["old mouse x"])
counters["copy old mouse x -> @line x1"] = max(counters["copy old mouse x -> @line x1"] - acc, 0)
counters["old mouse x"] = max(counters["old mouse x"] - acc, 0)
counters["used old mouse x"] = counters["used old mouse x"] + acc * 1
counters["@line x1"] = counters["@line x1"] + acc * 1
return true
elseif counters["copy old mouse y -> @line y1"] > 0 and counters["old mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["old mouse y"])
acc = min(acc, counters["copy old mouse y -> @line y1"])
counters["copy old mouse y -> @line y1"] = max(counters["copy old mouse y -> @line y1"] - acc, 0)
counters["old mouse y"] = max(counters["old mouse y"] - acc, 0)
counters["@line y1"] = counters["@line y1"] + acc * 1
counters["used old mouse y"] = counters["used old mouse y"] + acc * 1
return true
elseif counters["copy current mouse x -> @line x2"] > 0 and counters["current mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["copy current mouse x -> @line x2"])
acc = min(acc, counters["current mouse x"])
counters["copy current mouse x -> @line x2"] = max(counters["copy current mouse x -> @line x2"] - acc, 0)
counters["current mouse x"] = max(counters["current mouse x"] - acc, 0)
counters["used current mouse x"] = counters["used current mouse x"] + acc * 1
counters["@line x2"] = counters["@line x2"] + acc * 1
return true
elseif counters["copy current mouse y -> @line y2"] > 0 and counters["current mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["current mouse y"])
acc = min(acc, counters["copy current mouse y -> @line y2"])
counters["copy current mouse y -> @line y2"] = max(counters["copy current mouse y -> @line y2"] - acc, 0)
counters["current mouse y"] = max(counters["current mouse y"] - acc, 0)
counters["@line y2"] = counters["@line y2"] + acc * 1
counters["used current mouse y"] = counters["used current mouse y"] + acc * 1
return true
elseif counters["copy old mouse x -> @line x1"] > 0 then
local acc = huge
acc = min(acc, counters["copy old mouse x -> @line x1"])
counters["copy old mouse x -> @line x1"] = max(counters["copy old mouse x -> @line x1"] - acc, 0)
return true
elseif counters["copy old mouse y -> @line y1"] > 0 then
local acc = huge
acc = min(acc, counters["copy old mouse y -> @line y1"])
counters["copy old mouse y -> @line y1"] = max(counters["copy old mouse y -> @line y1"] - acc, 0)
return true
elseif counters["copy current mouse x -> @line x2"] > 0 then
local acc = huge
acc = min(acc, counters["copy current mouse x -> @line x2"])
counters["copy current mouse x -> @line x2"] = max(counters["copy current mouse x -> @line x2"] - acc, 0)
return true
elseif counters["copy current mouse y -> @line y2"] > 0 then
local acc = huge
acc = min(acc, counters["copy current mouse y -> @line y2"])
counters["copy current mouse y -> @line y2"] = max(counters["copy current mouse y -> @line y2"] - acc, 0)
return true
elseif counters["used old mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["used old mouse x"])
counters["used old mouse x"] = max(counters["used old mouse x"] - acc, 0)
counters["old mouse x"] = counters["old mouse x"] + acc * 1
return true
elseif counters["used old mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["used old mouse y"])
counters["used old mouse y"] = max(counters["used old mouse y"] - acc, 0)
counters["old mouse y"] = counters["old mouse y"] + acc * 1
return true
elseif counters["used current mouse x"] > 0 then
local acc = huge
acc = min(acc, counters["used current mouse x"])
counters["used current mouse x"] = max(counters["used current mouse x"] - acc, 0)
counters["current mouse x"] = counters["current mouse x"] + acc * 1
return true
elseif counters["used current mouse y"] > 0 then
local acc = huge
acc = min(acc, counters["used current mouse y"])
counters["used current mouse y"] = max(counters["used current mouse y"] - acc, 0)
counters["current mouse y"] = counters["current mouse y"] + acc * 1
return true
elseif counters["clear old mouse position"] > 0 then
local acc = huge
acc = min(acc, counters["clear old mouse position"])
counters["clear old mouse position"] = max(counters["clear old mouse position"] - acc, 0)
counters["clear old mouse y:1000000"] = counters["clear old mouse y:1000000"] + acc * 1
counters["clear old mouse x:1000000"] = counters["clear old mouse x:1000000"] + acc * 1
return true
elseif counters["move current mouse position to old mouse position"] > 0 then
local acc = huge
acc = min(acc, counters["move current mouse position to old mouse position"])
counters["move current mouse position to old mouse position"] = max(counters["move current mouse position to old mouse position"] - acc, 0)
counters["current mouse x -> old mouse x:1000000"] = counters["current mouse x -> old mouse x:1000000"] + acc * 1
counters["current mouse y -> old mouse y:1000000"] = counters["current mouse y -> old mouse y:1000000"] + acc * 1
return true
elseif counters["move @mouse position to current mouse position"] > 0 then
local acc = huge
acc = min(acc, counters["move @mouse position to current mouse position"])
counters["move @mouse position to current mouse position"] = max(counters["move @mouse position to current mouse position"] - acc, 0)
counters["@mouse y -> current mouse y:1000000"] = counters["@mouse y -> current mouse y:1000000"] + acc * 1
counters["@mouse x -> current mouse x:1000000"] = counters["@mouse x -> current mouse x:1000000"] + acc * 1
return true
elseif counters["update mouse position"] > 0 then
local acc = huge
acc = min(acc, counters["update mouse position"])
counters["update mouse position"] = max(counters["update mouse position"] - acc, 0)
counters["move @mouse position to current mouse position"] = counters["move @mouse position to current mouse position"] + acc * 1
counters["@mouse position"] = counters["@mouse position"] + acc * 1
counters["clear old mouse position"] = counters["clear old mouse position"] + acc * 1
counters["move current mouse position to old mouse position"] = counters["move current mouse position to old mouse position"] + acc * 1
return true
elseif counters["check if mouse button is down"] > 0 then
local acc = huge
acc = min(acc, counters["check if mouse button is down"])
counters["check if mouse button is down"] = max(counters["check if mouse button is down"] - acc, 0)
counters["@mouse is down"] = counters["@mouse is down"] + acc * 1
counters["@mouse button"] = counters["@mouse button"] + acc * 1
return true
elseif counters["set line to white"] > 0 then
local acc = huge
acc = min(acc, counters["set line to white"])
counters["set line to white"] = max(counters["set line to white"] - acc, 0)
counters["@pixel b:255"] = counters["@pixel b:255"] + acc * 1
counters["@pixel r:255"] = counters["@pixel r:255"] + acc * 1
counters["@pixel g:255"] = counters["@pixel g:255"] + acc * 1
return true
elseif counters["set line position"] > 0 then
local acc = huge
acc = min(acc, counters["set line position"])
counters["set line position"] = max(counters["set line position"] - acc, 0)
counters["copy current mouse x -> @line x2:1000000"] = counters["copy current mouse x -> @line x2:1000000"] + acc * 1
counters["copy current mouse y -> @line y2:1000000"] = counters["copy current mouse y -> @line y2:1000000"] + acc * 1
counters["copy old mouse x -> @line x1:1000000"] = counters["copy old mouse x -> @line x1:1000000"] + acc * 1
counters["copy old mouse y -> @line y1:1000000"] = counters["copy old mouse y -> @line y1:1000000"] + acc * 1
return true
elseif counters["draw the line"] > 0 then
local acc = huge
acc = min(acc, counters["draw the line"])
counters["draw the line"] = max(counters["draw the line"] - acc, 0)
counters["@draw line"] = counters["@draw line"] + acc * 1
return true
elseif counters["draw a line"] > 0 and counters["@mouse button is down"] > 0 then
local acc = huge
acc = min(acc, counters["@mouse button is down"])
acc = min(acc, counters["draw a line"])
counters["draw a line"] = max(counters["draw a line"] - acc, 0)
counters["@mouse button is down"] = max(counters["@mouse button is down"] - acc, 0)
counters["set line position"] = counters["set line position"] + acc * 1
counters["draw the line"] = counters["draw the line"] + acc * 1
counters["set line to white"] = counters["set line to white"] + acc * 1
return true
elseif counters["draw a line"] > 0 then
local acc = huge
acc = min(acc, counters["draw a line"])
counters["draw a line"] = max(counters["draw a line"] - acc, 0)
return true
elseif counters["update"] > 0 then
local acc = huge
acc = min(acc, counters["update"])
counters["update"] = max(counters["update"] - acc, 0)
counters["check if mouse button is down"] = counters["check if mouse button is down"] + acc * 1
counters["draw a line"] = counters["draw a line"] + acc * 1
counters["update mouse position"] = counters["update mouse position"] + acc * 1
return true
elseif counters["poll inputs"] > 0 then
local acc = huge
acc = min(acc, counters["poll inputs"])
counters["poll inputs"] = max(counters["poll inputs"] - acc, 0)
counters["@poll inputs"] = counters["@poll inputs"] + acc * 1
return true
elseif counters["draw"] > 0 then
local acc = huge
acc = min(acc, counters["draw"])
counters["draw"] = max(counters["draw"] - acc, 0)
counters["@display"] = counters["@display"] + acc * 1
return true
elseif counters["sleep"] > 0 then
local acc = huge
acc = min(acc, counters["sleep"])
counters["sleep"] = max(counters["sleep"] - acc, 0)
counters["@sleep:16"] = counters["@sleep:16"] + acc * 1
return true
elseif counters["main loop"] > 0 then
local acc = huge
acc = min(acc, counters["main loop"])
counters["main loop"] = max(counters["main loop"] - acc, 0)
counters["poll inputs"] = counters["poll inputs"] + acc * 1
counters["draw"] = counters["draw"] + acc * 1
counters["sleep"] = counters["sleep"] + acc * 1
counters["update"] = counters["update"] + acc * 1
counters["main loop"] = counters["main loop"] + acc * 1
return true
end
return false
end
| 1 | local min, max, huge = math.min, math.max, math.huge |
| 2 | return function(counters) |
| 3 | if counters["@sleep:60"] > 0 then |
| 4 | local acc = huge |
| 5 | acc = min(acc, counters["@sleep:60"]) |
| 6 | counters["@sleep:60"] = max(counters["@sleep:60"] - acc, 0) |
| 7 | counters["@sleep"] = counters["@sleep"] + acc * 60 |
| 8 | return true |
| 9 | elseif counters["@pixel r:255"] > 0 then |
| 10 | local acc = huge |
| 11 | acc = min(acc, counters["@pixel r:255"]) |
| 12 | counters["@pixel r:255"] = max(counters["@pixel r:255"] - acc, 0) |
| 13 | counters["@pixel r"] = counters["@pixel r"] + acc * 255 |
| 14 | return true |
| 15 | elseif counters["@pixel g:255"] > 0 then |
| 16 | local acc = huge |
| 17 | acc = min(acc, counters["@pixel g:255"]) |
| 18 | counters["@pixel g:255"] = max(counters["@pixel g:255"] - acc, 0) |
| 19 | counters["@pixel g"] = counters["@pixel g"] + acc * 255 |
| 20 | return true |
| 21 | elseif counters["@pixel b:255"] > 0 then |
| 22 | local acc = huge |
| 23 | acc = min(acc, counters["@pixel b:255"]) |
| 24 | counters["@pixel b:255"] = max(counters["@pixel b:255"] - acc, 0) |
| 25 | counters["@pixel b"] = counters["@pixel b"] + acc * 255 |
| 26 | return true |
| 27 | elseif counters["clear old mouse x:1000000"] > 0 then |
| 28 | local acc = huge |
| 29 | acc = min(acc, counters["clear old mouse x:1000000"]) |
| 30 | counters["clear old mouse x:1000000"] = max(counters["clear old mouse x:1000000"] - acc, 0) |
| 31 | counters["clear old mouse x"] = counters["clear old mouse x"] + acc * 1000000 |
| 32 | return true |
| 33 | elseif counters["clear old mouse y:1000000"] > 0 then |
| 34 | local acc = huge |
| 35 | acc = min(acc, counters["clear old mouse y:1000000"]) |
| 36 | counters["clear old mouse y:1000000"] = max(counters["clear old mouse y:1000000"] - acc, 0) |
| 37 | counters["clear old mouse y"] = counters["clear old mouse y"] + acc * 1000000 |
| 38 | return true |
| 39 | elseif counters["current mouse x -> old mouse x:1000000"] > 0 then |
| 40 | local acc = huge |
| 41 | acc = min(acc, counters["current mouse x -> old mouse x:1000000"]) |
| 42 | counters["current mouse x -> old mouse x:1000000"] = max(counters["current mouse x -> old mouse x:1000000"] - acc, 0) |
| 43 | counters["current mouse x -> old mouse x"] = counters["current mouse x -> old mouse x"] + acc * 1000000 |
| 44 | return true |
| 45 | elseif counters["current mouse y -> old mouse y:1000000"] > 0 then |
| 46 | local acc = huge |
| 47 | acc = min(acc, counters["current mouse y -> old mouse y:1000000"]) |
| 48 | counters["current mouse y -> old mouse y:1000000"] = max(counters["current mouse y -> old mouse y:1000000"] - acc, 0) |
| 49 | counters["current mouse y -> old mouse y"] = counters["current mouse y -> old mouse y"] + acc * 1000000 |
| 50 | return true |
| 51 | elseif counters["@mouse x -> current mouse x:1000000"] > 0 then |
| 52 | local acc = huge |
| 53 | acc = min(acc, counters["@mouse x -> current mouse x:1000000"]) |
| 54 | counters["@mouse x -> current mouse x:1000000"] = max(counters["@mouse x -> current mouse x:1000000"] - acc, 0) |
| 55 | counters["@mouse x -> current mouse x"] = counters["@mouse x -> current mouse x"] + acc * 1000000 |
| 56 | return true |
| 57 | elseif counters["@mouse y -> current mouse y:1000000"] > 0 then |
| 58 | local acc = huge |
| 59 | acc = min(acc, counters["@mouse y -> current mouse y:1000000"]) |
| 60 | counters["@mouse y -> current mouse y:1000000"] = max(counters["@mouse y -> current mouse y:1000000"] - acc, 0) |
| 61 | counters["@mouse y -> current mouse y"] = counters["@mouse y -> current mouse y"] + acc * 1000000 |
| 62 | return true |
| 63 | elseif counters["copy old mouse x -> @line x1:1000000"] > 0 then |
| 64 | local acc = huge |
| 65 | acc = min(acc, counters["copy old mouse x -> @line x1:1000000"]) |
| 66 | counters["copy old mouse x -> @line x1:1000000"] = max(counters["copy old mouse x -> @line x1:1000000"] - acc, 0) |
| 67 | counters["copy old mouse x -> @line x1"] = counters["copy old mouse x -> @line x1"] + acc * 1000000 |
| 68 | return true |
| 69 | elseif counters["copy old mouse y -> @line y1:1000000"] > 0 then |
| 70 | local acc = huge |
| 71 | acc = min(acc, counters["copy old mouse y -> @line y1:1000000"]) |
| 72 | counters["copy old mouse y -> @line y1:1000000"] = max(counters["copy old mouse y -> @line y1:1000000"] - acc, 0) |
| 73 | counters["copy old mouse y -> @line y1"] = counters["copy old mouse y -> @line y1"] + acc * 1000000 |
| 74 | return true |
| 75 | elseif counters["copy current mouse x -> @line x2:1000000"] > 0 then |
| 76 | local acc = huge |
| 77 | acc = min(acc, counters["copy current mouse x -> @line x2:1000000"]) |
| 78 | counters["copy current mouse x -> @line x2:1000000"] = max(counters["copy current mouse x -> @line x2:1000000"] - acc, 0) |
| 79 | counters["copy current mouse x -> @line x2"] = counters["copy current mouse x -> @line x2"] + acc * 1000000 |
| 80 | return true |
| 81 | elseif counters["copy current mouse y -> @line y2:1000000"] > 0 then |
| 82 | local acc = huge |
| 83 | acc = min(acc, counters["copy current mouse y -> @line y2:1000000"]) |
| 84 | counters["copy current mouse y -> @line y2:1000000"] = max(counters["copy current mouse y -> @line y2:1000000"] - acc, 0) |
| 85 | counters["copy current mouse y -> @line y2"] = counters["copy current mouse y -> @line y2"] + acc * 1000000 |
| 86 | return true |
| 87 | elseif counters["clear old mouse x"] > 0 and counters["old mouse x"] > 0 then |
| 88 | local acc = huge |
| 89 | acc = min(acc, counters["clear old mouse x"]) |
| 90 | acc = min(acc, counters["old mouse x"]) |
| 91 | counters["clear old mouse x"] = max(counters["clear old mouse x"] - acc, 0) |
| 92 | counters["old mouse x"] = max(counters["old mouse x"] - acc, 0) |
| 93 | return true |
| 94 | elseif counters["clear old mouse x"] > 0 then |
| 95 | local acc = huge |
| 96 | acc = min(acc, counters["clear old mouse x"]) |
| 97 | counters["clear old mouse x"] = max(counters["clear old mouse x"] - acc, 0) |
| 98 | return true |
| 99 | elseif counters["clear old mouse y"] > 0 and counters["old mouse y"] > 0 then |
| 100 | local acc = huge |
| 101 | acc = min(acc, counters["old mouse y"]) |
| 102 | acc = min(acc, counters["clear old mouse y"]) |
| 103 | counters["clear old mouse y"] = max(counters["clear old mouse y"] - acc, 0) |
| 104 | counters["old mouse y"] = max(counters["old mouse y"] - acc, 0) |
| 105 | return true |
| 106 | elseif counters["clear old mouse y"] > 0 then |
| 107 | local acc = huge |
| 108 | acc = min(acc, counters["clear old mouse y"]) |
| 109 | counters["clear old mouse y"] = max(counters["clear old mouse y"] - acc, 0) |
| 110 | return true |
| 111 | elseif counters["current mouse x -> old mouse x"] > 0 and counters["current mouse x"] > 0 then |
| 112 | local acc = huge |
| 113 | acc = min(acc, counters["current mouse x -> old mouse x"]) |
| 114 | acc = min(acc, counters["current mouse x"]) |
| 115 | counters["current mouse x -> old mouse x"] = max(counters["current mouse x -> old mouse x"] - acc, 0) |
| 116 | counters["current mouse x"] = max(counters["current mouse x"] - acc, 0) |
| 117 | counters["old mouse x"] = counters["old mouse x"] + acc * 1 |
| 118 | return true |
| 119 | elseif counters["current mouse y -> old mouse y"] > 0 and counters["current mouse y"] > 0 then |
| 120 | local acc = huge |
| 121 | acc = min(acc, counters["current mouse y"]) |
| 122 | acc = min(acc, counters["current mouse y -> old mouse y"]) |
| 123 | counters["current mouse y -> old mouse y"] = max(counters["current mouse y -> old mouse y"] - acc, 0) |
| 124 | counters["current mouse y"] = max(counters["current mouse y"] - acc, 0) |
| 125 | counters["old mouse y"] = counters["old mouse y"] + acc * 1 |
| 126 | return true |
| 127 | elseif counters["current mouse x -> old mouse x"] > 0 then |
| 128 | local acc = huge |
| 129 | acc = min(acc, counters["current mouse x -> old mouse x"]) |
| 130 | counters["current mouse x -> old mouse x"] = max(counters["current mouse x -> old mouse x"] - acc, 0) |
| 131 | return true |
| 132 | elseif counters["current mouse y -> old mouse y"] > 0 then |
| 133 | local acc = huge |
| 134 | acc = min(acc, counters["current mouse y -> old mouse y"]) |
| 135 | counters["current mouse y -> old mouse y"] = max(counters["current mouse y -> old mouse y"] - acc, 0) |
| 136 | return true |
| 137 | elseif counters["@mouse x -> current mouse x"] > 0 and counters["@mouse x"] > 0 then |
| 138 | local acc = huge |
| 139 | acc = min(acc, counters["@mouse x -> current mouse x"]) |
| 140 | acc = min(acc, counters["@mouse x"]) |
| 141 | counters["@mouse x -> current mouse x"] = max(counters["@mouse x -> current mouse x"] - acc, 0) |
| 142 | counters["@mouse x"] = max(counters["@mouse x"] - acc, 0) |
| 143 | counters["current mouse x"] = counters["current mouse x"] + acc * 1 |
| 144 | return true |
| 145 | elseif counters["@mouse y -> current mouse y"] > 0 and counters["@mouse y"] > 0 then |
| 146 | local acc = huge |
| 147 | acc = min(acc, counters["@mouse y"]) |
| 148 | acc = min(acc, counters["@mouse y -> current mouse y"]) |
| 149 | counters["@mouse y -> current mouse y"] = max(counters["@mouse y -> current mouse y"] - acc, 0) |
| 150 | counters["@mouse y"] = max(counters["@mouse y"] - acc, 0) |
| 151 | counters["current mouse y"] = counters["current mouse y"] + acc * 1 |
| 152 | return true |
| 153 | elseif counters["@mouse x -> current mouse x"] > 0 then |
| 154 | local acc = huge |
| 155 | acc = min(acc, counters["@mouse x -> current mouse x"]) |
| 156 | counters["@mouse x -> current mouse x"] = max(counters["@mouse x -> current mouse x"] - acc, 0) |
| 157 | return true |
| 158 | elseif counters["@mouse y -> current mouse y"] > 0 then |
| 159 | local acc = huge |
| 160 | acc = min(acc, counters["@mouse y -> current mouse y"]) |
| 161 | counters["@mouse y -> current mouse y"] = max(counters["@mouse y -> current mouse y"] - acc, 0) |
| 162 | return true |
| 163 | elseif counters["copy old mouse x -> @line x1"] > 0 and counters["old mouse x"] > 0 then |
| 164 | local acc = huge |
| 165 | acc = min(acc, counters["copy old mouse x -> @line x1"]) |
| 166 | acc = min(acc, counters["old mouse x"]) |
| 167 | counters["copy old mouse x -> @line x1"] = max(counters["copy old mouse x -> @line x1"] - acc, 0) |
| 168 | counters["old mouse x"] = max(counters["old mouse x"] - acc, 0) |
| 169 | counters["used old mouse x"] = counters["used old mouse x"] + acc * 1 |
| 170 | counters["@line x1"] = counters["@line x1"] + acc * 1 |
| 171 | return true |
| 172 | elseif counters["copy old mouse y -> @line y1"] > 0 and counters["old mouse y"] > 0 then |
| 173 | local acc = huge |
| 174 | acc = min(acc, counters["old mouse y"]) |
| 175 | acc = min(acc, counters["copy old mouse y -> @line y1"]) |
| 176 | counters["copy old mouse y -> @line y1"] = max(counters["copy old mouse y -> @line y1"] - acc, 0) |
| 177 | counters["old mouse y"] = max(counters["old mouse y"] - acc, 0) |
| 178 | counters["@line y1"] = counters["@line y1"] + acc * 1 |
| 179 | counters["used old mouse y"] = counters["used old mouse y"] + acc * 1 |
| 180 | return true |
| 181 | elseif counters["copy current mouse x -> @line x2"] > 0 and counters["current mouse x"] > 0 then |
| 182 | local acc = huge |
| 183 | acc = min(acc, counters["copy current mouse x -> @line x2"]) |
| 184 | acc = min(acc, counters["current mouse x"]) |
| 185 | counters["copy current mouse x -> @line x2"] = max(counters["copy current mouse x -> @line x2"] - acc, 0) |
| 186 | counters["current mouse x"] = max(counters["current mouse x"] - acc, 0) |
| 187 | counters["used current mouse x"] = counters["used current mouse x"] + acc * 1 |
| 188 | counters["@line x2"] = counters["@line x2"] + acc * 1 |
| 189 | return true |
| 190 | elseif counters["copy current mouse y -> @line y2"] > 0 and counters["current mouse y"] > 0 then |
| 191 | local acc = huge |
| 192 | acc = min(acc, counters["current mouse y"]) |
| 193 | acc = min(acc, counters["copy current mouse y -> @line y2"]) |
| 194 | counters["copy current mouse y -> @line y2"] = max(counters["copy current mouse y -> @line y2"] - acc, 0) |
| 195 | counters["current mouse y"] = max(counters["current mouse y"] - acc, 0) |
| 196 | counters["@line y2"] = counters["@line y2"] + acc * 1 |
| 197 | counters["used current mouse y"] = counters["used current mouse y"] + acc * 1 |
| 198 | return true |
| 199 | elseif counters["copy old mouse x -> @line x1"] > 0 then |
| 200 | local acc = huge |
| 201 | acc = min(acc, counters["copy old mouse x -> @line x1"]) |
| 202 | counters["copy old mouse x -> @line x1"] = max(counters["copy old mouse x -> @line x1"] - acc, 0) |
| 203 | return true |
| 204 | elseif counters["copy old mouse y -> @line y1"] > 0 then |
| 205 | local acc = huge |
| 206 | acc = min(acc, counters["copy old mouse y -> @line y1"]) |
| 207 | counters["copy old mouse y -> @line y1"] = max(counters["copy old mouse y -> @line y1"] - acc, 0) |
| 208 | return true |
| 209 | elseif counters["copy current mouse x -> @line x2"] > 0 then |
| 210 | local acc = huge |
| 211 | acc = min(acc, counters["copy current mouse x -> @line x2"]) |
| 212 | counters["copy current mouse x -> @line x2"] = max(counters["copy current mouse x -> @line x2"] - acc, 0) |
| 213 | return true |
| 214 | elseif counters["copy current mouse y -> @line y2"] > 0 then |
| 215 | local acc = huge |
| 216 | acc = min(acc, counters["copy current mouse y -> @line y2"]) |
| 217 | counters["copy current mouse y -> @line y2"] = max(counters["copy current mouse y -> @line y2"] - acc, 0) |
| 218 | return true |
| 219 | elseif counters["used old mouse x"] > 0 then |
| 220 | local acc = huge |
| 221 | acc = min(acc, counters["used old mouse x"]) |
| 222 | counters["used old mouse x"] = max(counters["used old mouse x"] - acc, 0) |
| 223 | counters["old mouse x"] = counters["old mouse x"] + acc * 1 |
| 224 | return true |
| 225 | elseif counters["used old mouse y"] > 0 then |
| 226 | local acc = huge |
| 227 | acc = min(acc, counters["used old mouse y"]) |
| 228 | counters["used old mouse y"] = max(counters["used old mouse y"] - acc, 0) |
| 229 | counters["old mouse y"] = counters["old mouse y"] + acc * 1 |
| 230 | return true |
| 231 | elseif counters["used current mouse x"] > 0 then |
| 232 | local acc = huge |
| 233 | acc = min(acc, counters["used current mouse x"]) |
| 234 | counters["used current mouse x"] = max(counters["used current mouse x"] - acc, 0) |
| 235 | counters["current mouse x"] = counters["current mouse x"] + acc * 1 |
| 236 | return true |
| 237 | elseif counters["used current mouse y"] > 0 then |
| 238 | local acc = huge |
| 239 | acc = min(acc, counters["used current mouse y"]) |
| 240 | counters["used current mouse y"] = max(counters["used current mouse y"] - acc, 0) |
| 241 | counters["current mouse y"] = counters["current mouse y"] + acc * 1 |
| 242 | return true |
| 243 | elseif counters["clear old mouse position"] > 0 then |
| 244 | local acc = huge |
| 245 | acc = min(acc, counters["clear old mouse position"]) |
| 246 | counters["clear old mouse position"] = max(counters["clear old mouse position"] - acc, 0) |
| 247 | counters["clear old mouse y:1000000"] = counters["clear old mouse y:1000000"] + acc * 1 |
| 248 | counters["clear old mouse x:1000000"] = counters["clear old mouse x:1000000"] + acc * 1 |
| 249 | return true |
| 250 | elseif counters["move current mouse position to old mouse position"] > 0 then |
| 251 | local acc = huge |
| 252 | acc = min(acc, counters["move current mouse position to old mouse position"]) |
| 253 | counters["move current mouse position to old mouse position"] = max(counters["move current mouse position to old mouse position"] - acc, 0) |
| 254 | counters["current mouse x -> old mouse x:1000000"] = counters["current mouse x -> old mouse x:1000000"] + acc * 1 |
| 255 | counters["current mouse y -> old mouse y:1000000"] = counters["current mouse y -> old mouse y:1000000"] + acc * 1 |
| 256 | return true |
| 257 | elseif counters["move @mouse position to current mouse position"] > 0 then |
| 258 | local acc = huge |
| 259 | acc = min(acc, counters["move @mouse position to current mouse position"]) |
| 260 | counters["move @mouse position to current mouse position"] = max(counters["move @mouse position to current mouse position"] - acc, 0) |
| 261 | counters["@mouse y -> current mouse y:1000000"] = counters["@mouse y -> current mouse y:1000000"] + acc * 1 |
| 262 | counters["@mouse x -> current mouse x:1000000"] = counters["@mouse x -> current mouse x:1000000"] + acc * 1 |
| 263 | return true |
| 264 | elseif counters["update mouse position"] > 0 then |
| 265 | local acc = huge |
| 266 | acc = min(acc, counters["update mouse position"]) |
| 267 | counters["update mouse position"] = max(counters["update mouse position"] - acc, 0) |
| 268 | counters["move @mouse position to current mouse position"] = counters["move @mouse position to current mouse position"] + acc * 1 |
| 269 | counters["@mouse position"] = counters["@mouse position"] + acc * 1 |
| 270 | counters["clear old mouse position"] = counters["clear old mouse position"] + acc * 1 |
| 271 | counters["move current mouse position to old mouse position"] = counters["move current mouse position to old mouse position"] + acc * 1 |
| 272 | return true |
| 273 | elseif counters["check if mouse button is down"] > 0 then |
| 274 | local acc = huge |
| 275 | acc = min(acc, counters["check if mouse button is down"]) |
| 276 | counters["check if mouse button is down"] = max(counters["check if mouse button is down"] - acc, 0) |
| 277 | counters["@mouse is down"] = counters["@mouse is down"] + acc * 1 |
| 278 | counters["@mouse button"] = counters["@mouse button"] + acc * 1 |
| 279 | return true |
| 280 | elseif counters["set line to white"] > 0 then |
| 281 | local acc = huge |
| 282 | acc = min(acc, counters["set line to white"]) |
| 283 | counters["set line to white"] = max(counters["set line to white"] - acc, 0) |
| 284 | counters["@pixel b:255"] = counters["@pixel b:255"] + acc * 1 |
| 285 | counters["@pixel r:255"] = counters["@pixel r:255"] + acc * 1 |
| 286 | counters["@pixel g:255"] = counters["@pixel g:255"] + acc * 1 |
| 287 | return true |
| 288 | elseif counters["set line position"] > 0 then |
| 289 | local acc = huge |
| 290 | acc = min(acc, counters["set line position"]) |
| 291 | counters["set line position"] = max(counters["set line position"] - acc, 0) |
| 292 | counters["copy current mouse x -> @line x2:1000000"] = counters["copy current mouse x -> @line x2:1000000"] + acc * 1 |
| 293 | counters["copy current mouse y -> @line y2:1000000"] = counters["copy current mouse y -> @line y2:1000000"] + acc * 1 |
| 294 | counters["copy old mouse x -> @line x1:1000000"] = counters["copy old mouse x -> @line x1:1000000"] + acc * 1 |
| 295 | counters["copy old mouse y -> @line y1:1000000"] = counters["copy old mouse y -> @line y1:1000000"] + acc * 1 |
| 296 | return true |
| 297 | elseif counters["draw the line"] > 0 then |
| 298 | local acc = huge |
| 299 | acc = min(acc, counters["draw the line"]) |
| 300 | counters["draw the line"] = max(counters["draw the line"] - acc, 0) |
| 301 | counters["@draw line"] = counters["@draw line"] + acc * 1 |
| 302 | return true |
| 303 | elseif counters["draw a line"] > 0 and counters["@mouse button is down"] > 0 then |
| 304 | local acc = huge |
| 305 | acc = min(acc, counters["@mouse button is down"]) |
| 306 | acc = min(acc, counters["draw a line"]) |
| 307 | counters["draw a line"] = max(counters["draw a line"] - acc, 0) |
| 308 | counters["@mouse button is down"] = max(counters["@mouse button is down"] - acc, 0) |
| 309 | counters["set line position"] = counters["set line position"] + acc * 1 |
| 310 | counters["draw the line"] = counters["draw the line"] + acc * 1 |
| 311 | counters["set line to white"] = counters["set line to white"] + acc * 1 |
| 312 | return true |
| 313 | elseif counters["draw a line"] > 0 then |
| 314 | local acc = huge |
| 315 | acc = min(acc, counters["draw a line"]) |
| 316 | counters["draw a line"] = max(counters["draw a line"] - acc, 0) |
| 317 | return true |
| 318 | elseif counters["update"] > 0 then |
| 319 | local acc = huge |
| 320 | acc = min(acc, counters["update"]) |
| 321 | counters["update"] = max(counters["update"] - acc, 0) |
| 322 | counters["check if mouse button is down"] = counters["check if mouse button is down"] + acc * 1 |
| 323 | counters["draw a line"] = counters["draw a line"] + acc * 1 |
| 324 | counters["update mouse position"] = counters["update mouse position"] + acc * 1 |
| 325 | return true |
| 326 | elseif counters["poll inputs"] > 0 then |
| 327 | local acc = huge |
| 328 | acc = min(acc, counters["poll inputs"]) |
| 329 | counters["poll inputs"] = max(counters["poll inputs"] - acc, 0) |
| 330 | counters["@poll inputs"] = counters["@poll inputs"] + acc * 1 |
| 331 | return true |
| 332 | elseif counters["draw"] > 0 then |
| 333 | local acc = huge |
| 334 | acc = min(acc, counters["draw"]) |
| 335 | counters["draw"] = max(counters["draw"] - acc, 0) |
| 336 | counters["@display"] = counters["@display"] + acc * 1 |
| 337 | return true |
| 338 | elseif counters["sleep"] > 0 then |
| 339 | local acc = huge |
| 340 | acc = min(acc, counters["sleep"]) |
| 341 | counters["sleep"] = max(counters["sleep"] - acc, 0) |
| 342 | counters["@sleep:16"] = counters["@sleep:16"] + acc * 1 |
| 343 | return true |
| 344 | elseif counters["main loop"] > 0 then |
| 345 | local acc = huge |
| 346 | acc = min(acc, counters["main loop"]) |
| 347 | counters["main loop"] = max(counters["main loop"] - acc, 0) |
| 348 | counters["poll inputs"] = counters["poll inputs"] + acc * 1 |
| 349 | counters["draw"] = counters["draw"] + acc * 1 |
| 350 | counters["sleep"] = counters["sleep"] + acc * 1 |
| 351 | counters["update"] = counters["update"] + acc * 1 |
| 352 | counters["main loop"] = counters["main loop"] + acc * 1 |
| 353 | return true |
| 354 | end |
| 355 | return false |
| 356 | end |