Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

30
LINES

< > BotCompany Repo | #184 // GUI event dumper

Rendition of first frame

Lua code - GUI

1  
get('#175') -- tableToString
2  
3  
width=100
4  
height=50
5  
--print("pixels:", pixels)
6  
repaint=not notFirstTime
7  
notFirstTime=true
8  
pixels=nil -- optimization (no redraw effort if image not changed)
9  
10  
if inputEvents then
11  
  for _, e in ipairs(inputEvents) do
12  
    print(tableToString(e))
13  
    if e[1] == 'mousePressed' then
14  
      mouse = true
15  
      repaint = true
16  
    elseif e[1] == 'mouseReleased' then
17  
      mouse = false
18  
      repaint = true
19  
    end
20  
  end
21  
end
22  
23  
if repaint then
24  
  pixels = {}
25  
  if mouse then
26  
    for i=1, width*height do pixels[i] = -1 end
27  
  end
28  
end
29  
30  
animateAgainIn = 100

Author comment

\n\nBegan life as a copy of #106

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

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 602 [visualize]

Snippet ID: #184
Snippet name: GUI event dumper
Eternal ID of this version: #184/1
Text MD5: 374e2ce9f1249deaeaf4452fab5b3cbb
Author: stefan
Category: gui tests
Type: Lua code - GUI
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-01-16 06:52:16
Source code size: 602 bytes / 30 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 775 / 219
Referenced in: [show references]