Advertisement
TwitchBlade

DisplayLib.lua

Apr 22nd, 2024 (edited)
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | Gaming | 0 0
  1. DisplayLib = {}
  2. function DisplayLib.initDisplay(mon)
  3.     mon.setTextColor(colors.white)
  4.     mon.setBackgroundColor(colors.black)
  5.     x1,y1 = mon.getSize()
  6.     bt = {}
  7.     for x=1,x1 do
  8.         bt[x]={}
  9.         for y=1,y1 do
  10.             bt[x][y] = nil
  11.         end
  12.     end
  13.     return bt
  14. end
  15.  
  16. function DisplayLib.drawButton(screen, color1, color2, x, y, xsize, ysize,xtext,ytext,text, funcCall, mon)
  17.     mon.setTextColor(color1)
  18.     mon.setBackgroundColor(color2)
  19.     for i=x,x+xsize-1 do
  20.        for j=y,y+ysize-1 do
  21.            screen[i][j] = funcCall
  22.            mon.setCursorPos(i,j)
  23.            
  24.            mon.write(" ")
  25.        end
  26.     end
  27.     mon.setCursorPos(xtext,ytext)
  28.     mon.write(text)
  29.     mon.setTextColor(colors.white)
  30.     mon.setBackgroundColor(colors.black)
  31. end
  32.  
  33. return DisplayLib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement