Advertisement
ValveCantCount

Untitled

Nov 5th, 2020 (edited)
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. local cobalt = dofile('cobalt')
  2. cobalt.ui = dofile('cobalt-ui/init.lua')
  3.  
  4. local Panel = cobalt.ui.new({ w = "50%", marginleft="25%", h = "50%", margintop = "25%" })
  5. local Button = Panel:add("button", { wrap="center", y = 4})
  6. Button.onclick = function()
  7. print("hi")
  8. end
  9.  
  10. function cobalt.update( dt )
  11. --your code
  12. cobalt.ui.update( dt )
  13. end
  14.  
  15. function cobalt.draw()
  16. --your code
  17. cobalt.ui.draw( )
  18. end
  19.  
  20. function cobalt.mousepressed(x, y, button)
  21. --your code
  22. if x ~= nil and y ~= nil then
  23.  
  24. else
  25. print("nil")
  26. end
  27. cobalt.ui.mousepressed(x, y, button)
  28. end
  29.  
  30. function cobalt.mousereleased(x, y, button)
  31. --your code
  32. if x ~= nil and y ~= nil then
  33.  
  34. else
  35. print("nil")
  36. end
  37. cobalt.ui.mousereleased(x, y, button)
  38. end
  39.  
  40. function cobalt.keypressed(keycode, key)
  41. --your code
  42. cobalt.ui.keypressed(keycode, key)
  43. end
  44.  
  45. function cobalt.keyreleased(keycode, key)
  46. --your code
  47. cobalt.ui.keyreleased(keycode, key)
  48. end
  49.  
  50. function cobalt.textinput(t)
  51. --your code
  52. cobalt.ui.textinput(t)
  53. end
  54.  
  55. cobalt.initLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement