width=100 height=50 --print("pixels:", pixels) repaint=not notFirstTime notFirstTime=true pixels=nil -- optimization (no redraw effort if image not changed) if inputEvents then for _, e in ipairs(inputEvents) do --print(e[1]) if e[1] == 'mousePressed' then mouse = true repaint = true elseif e[1] == 'mouseReleased' then mouse = false repaint = true end end end if repaint then pixels = {} if mouse then for i=1, width*height do pixels[i] = -1 end end end animateAgainIn = 100
It works! :) Now with optimization to avoid idle redraws.
show applet test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Recognizer | Recognition Result | Visualize | Recalc |
---|---|---|---|
#308 | 560 | [visualize] |
Snippet ID: | #106 |
Snippet name: | GUI mouse event test |
Eternal ID of this version: | #106/1 |
Text MD5: | a3745a5ff9c9ceb49e46804315465c95 |
Author: | stefan |
Category: | gui tests |
Type: | Lua code - GUI |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2014-01-09 03:06:07 |
Source code size: | 560 bytes / 28 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1603 / 362 |
Referenced in: | [show references] |