Advertisement
Guest User

gogame.lua

a guest
Apr 30th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. event = require("event")
  2. component = require("component")
  3. term = require("term")
  4. Go = require("go")
  5.  
  6. function show(t)
  7.   for k,v in pairs(t) do
  8.     print(k,v)
  9.   end
  10. end
  11.  
  12. gpu = component.gpu
  13. screen = component.screen
  14.  
  15. SX, SY = gpu.getResolution()
  16. BG = 0x000055
  17.  
  18. function redraw(game)
  19.   gpu.setBackground(BG)
  20.   gpu.fill(1,1,SX,SY,' ')
  21.   term.setCursor(1,1)
  22.   game:show()
  23. end
  24.  
  25. game = Go:new(9)
  26. redraw(game)
  27.  
  28. while true do
  29.   e,adress,x,y,mouse = event.pull()
  30.   if e == "touch" then
  31.     game:touched(x, y)
  32.     --redraw(game)
  33.   end
  34.   if e == "interrupted" then
  35.     gpu.setBackground(0x000000)
  36.     return
  37.   end
  38.   --print(e,adress,x,y,mouse)
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement