Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bdraw(xp1,yp1,xp2,yp2,txt,col)
- if col==nil then
- mon.setBackgroundColor(colors.lime)
- else
- mon.setBackgroundColor(col)
- end
- mon.setCursorPos(xp1,yp1)
- for i=1,(xp2-xp1) do
- mon.write("-")
- end
- mon.setCursorPos(xp1,yp2)
- for i=1,(xp2-xp1) do
- mon.write("-")
- end
- for i=yp1,yp2 do
- mon.setCursorPos(xp1,i)
- mon.write("|")
- mon.setCursorPos(xp2,i)
- mon.write("|")
- end
- for i=(yp1+1),(yp2-1) do
- mon.setCursorPos((xp1+1),i)
- for j=(xp1+1),(xp2-1) do
- mon.write(" ")
- j = j+1
- end
- i = i+1
- end
- if math.floor(((xp2-xp1)-#txt)/2)==0 then
- xp1 = xp1+1
- end
- mon.setCursorPos(math.floor(((xp2-xp1)-#txt)/2)+xp1,math.floor((yp2-yp1)/2)+yp1)
- print(math.floor(((xp2-xp1)-#txt)/2))
- mon.write(txt)
- end
- function bdrawnb(x1,y1,x2,y2,text,color,tcol)
- mon.setBackgroundColor(color)
- for i=y1,y2 do
- mon.setCursorPos(x1,i)
- for j=x1,x2 do
- mon.write(" ")
- end
- end
- if (x2-x1)<=#text then
- mon.setCursorPos(x1,math.floor((y2-y1)/2)+y1)
- else
- mon.setCursorPos(math.floor(((x2-x1)-#text)/2)+x1,math.floor((y2-y1)/2)+y1)
- end
- if tcol==nil then
- mon.setTextColor(colors.gray)
- else
- mon.setTextColor(tcol)
- end
- mon.write(text)
- mon.setTextColor(colors.gray)
- end
- function checkButtons(xPos, yPos)
- if not event=="monitor_touch" then
- return
- end
- if xPos>=2 and xPos<=18 and yPos>=y-3 and yPos<=y-1 then
- bdraw(2,y-3,18,y-1,"Button 1",colors.magenta)
- //hier kommt das hin was passieren soll wenn der Button gedrueckt wird
- sleep(0.25)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement