Advertisement
Ceziy

GLib example

Mar 10th, 2025 (edited)
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. os.loadAPI("GLib.lua")
  2. local gl = GLib
  3. gl:addCloseButton()
  4.  
  5. a = gl.Text("test", 2, 2, colors.purple)
  6. a:blit()
  7.  
  8. b = gl.Text("test1", 5, 3)
  9. b:blit()
  10.  
  11. c = gl.Text("test2", 8, 4, colors.yellow)
  12. c:blit()
  13.  
  14. p = gl.ProgressBar(3, 10, 20, 3)
  15. p:blit()
  16. bpm = gl.Button(3, 13, 10, 1, nil, nil, nil, "<--", function() p:addProgress(-0.05) end)
  17. bpm:blit()
  18.  
  19. bpp = gl.Button(13, 13, 10, 1, nil, nil, nil, "-->", function() p:addProgress(0.05) end)
  20. bpp:blit()
  21.  
  22. bt = gl.Text("", 16, 7)
  23. bt:blit()
  24.  
  25. but = gl.Button(3, 6, 11, 3, colors.cyan, colors.blue, colors.white, "button", function() bt:setText("btn was pressed!") end)
  26. but:blit()
  27.  
  28. ch = gl.CheckBox(17, 3, colors.gray, colors.white)
  29. ch:setSymbol("x")
  30. ch:blit()
  31.  
  32. input = gl.TextInput(3, 15, 20, colors.white, colors.gray)
  33. input:blit()
  34.  
  35. input1 = gl.TextInput(3, 17, 20, colors.white, colors.gray)
  36. input1:blit()
  37.  
  38. inpch = gl.CheckBox(25, 17)
  39. inpch:setSymbol("x")
  40. inpch:blit()
  41.  
  42. function loop()
  43.     if ch:isChecked() then
  44.         b:setColor(colors.green)
  45.     else
  46.         b:setColor(colors.white)
  47.     end
  48.  
  49.     if inpch:isChecked() then
  50.         input1:hideText(false)
  51.     else
  52.         input1:hideText(true)
  53.     end
  54. end
  55.  
  56. gl.mainloop(loop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement