Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Objects
- local GUIElement = {}
- function GUIElement:Constructor(Name, Text, BlinkText, FirstColor, SecondColor, FirstTextColor, SecondTextColor, PosX, PosY)
- obj = {}
- obj.name = Name or "unnamed"
- obj.text = Text or "undefined"
- obj.blinktext = BlinkText or " "
- obj.fcolor = FirstColor or colors.black
- obj.scolor = SecondColor or colors.white
- obj.ftcolor = FirstTextColor or colors.gray
- obj.stcolor = SecondTextColor or colors.white
- obj.x = PosX or 1
- obj.y = PosY or 1
- obj.active = false
- setmetatable(obj, self)
- self.__index = self
- return obj
- end
- function GUIElement:Blink()
- if self.active then
- term.setBackgroundColor(self.fcolor)
- term.setTextColor(self.ftcolor)
- else
- term.setBackgroundColor(self.scolor)
- term.setTextColor(self.stcolor)
- end
- term.setCursorPos(self.x, self.y)
- term.write(self.blinktext)
- term.setBackgroundColor(self.scolor)
- term.setTextColor(self.ftcolor)
- term.write(" " .. self.text)
- self.active = not self.active
- end
- --Program
- local points = {}
- function CreateBlinkPoint(Name, Text, BlinkText, FirstColor, SecondColor, FirstTextColor, SecondTextColor, PosX, PosY, Blink)
- points[Name] = GUIElement:Constructor(Name, Text, BlinkText, FirstColor, SecondColor, FirstTextColor, SecondTextColor, PosX, PosY, Blink)
- return points[Name]
- end
- function DrawPoints()
- for _, value in pairs(points) do
- value:Blink()
- end
- end
- function DestroyBlinkPoint(Name)
- points[Name] = nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement