Advertisement
BigSHinyToys

example program

Apr 30th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local win = getWindowHandel()
  2. win:setTitle("WIN 3 test3")
  3. local clickMe = newButton()
  4. local tButtonsList = {}
  5. local c = 0
  6. --[[for x = 1, 4 do
  7.   for y = 1, 4 do
  8.     local cl = newButton()
  9.     cl:setPos((x*10) - 8,(y*3) - 1)
  10.     table.insert(tButtonsList,cl)
  11.     win:addComponent(cl)
  12.   end
  13. ]]--end
  14. --clickMe:paint()
  15. --os.pullEvent()
  16. win:addComponent(clickMe)
  17. local function nWin()
  18. c = c + 1
  19. local nWin = getWindowHandel()
  20. nWin:setTitle("newWin"..tostring(c))
  21. end
  22. clickMe:setFunction(nWin)
  23. local x,y = 2,2
  24. win:setPos(x,y)
  25. local oldX,oldY
  26. while true do
  27. local event = {os.pullEvent()}
  28.   if event[1] == "char" then
  29.     if event[2] == "y" then -- up
  30.       y = y - 1
  31.     elseif event[2] == "h" then
  32.       y = y + 1
  33.     elseif event[2] == "g" then
  34.       x = x - 1
  35.     elseif event[2] == "j" then
  36.       x = x + 1
  37.     end
  38.     win:setPos(x,y)
  39.   end
  40. --win:setStatus("maximised")
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement