-return function(t,fb,g,r,b)
+return function(t,fb,g,r,b)
t:unregister()
fb:fill(0,0,0)
local ix = 0
ix = 1 - ix
dodraw()
end)
-end
\ No newline at end of file
+end
local function drawfailsafe(t,fb,g,r,b) fb:fill(g,r,b) end
function loaddrawfn(name)
- local f = loadfile ("draw-%s.lc":format(name))
+ print("The name is ")
+ print(name)
+ local f = loadfile (string.format("draw-%s.lc", name))
local fn = f and f()
if fn then return fn else return drawfailsafe end
end
-- Whip through the drawing functions and build indexes
local k,v
for k,v in pairs(file.list()) do
- local ix, _, meth = k:find("^draw-(%w+)\\.lc$")
+ local ix, _, meth = k:find("^draw%-(%w+)%.lc$")
if ix then
+ print("XXXXX touching", meth, #touchfns)
touchfns[#touchfns+1] = meth
if meth == "fill" then touchfnix = #touchfns end
end
-- front middle: mode select (rate-limited, not exactly debounced)
if bit.isset(down,3) then
+ print("front middle touched", touch_db_fn)
if touch_db_fn == nil then
touchfnix = touchfnix + 1
if touchfnix > #touchfns then touchfnix = 1 end
touch_db_fn = touch_tq:queue(200,onfndebounce)
+ print("the function is now", touch_db_fn)
end
claimfb()
end
-- if bit.isset(down,4) then end
-- draw if we've claimed it!
+ print("ahhhh", ledfb, touchfb)
if ledfb == touchfb then
touchtmr:unregister()
+ print("XXXXX looking for XXXXX")
+ print(touchfnix)
loaddrawfn(touchfns[touchfnix])(touchtmr,touchfb,touchcolorvec(touchcolor)); dodraw()
touchtmr:start()
end