Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gpu = require("component").gpu
- local event = require("event")
- local unicode = require("unicode")
- local IsInited = false
- local gui = {}
- local elements -- = {}
- local timers -- = {}
- gui.Version = "0.6"
- -- function gui.getVersion(requestVersion)
- -- if type(goodVersion) ~= "table" then
- -- return false
- -- end
- -- if V
- -- end
- --gui.Elements = elements
- function gui.NewIsClicked(x1, y1, x2, y2)
- return function(x, y) return x1 <= x and x <= x2 and y1 <= y and y <= y2;end
- end
- function gui:IsClicked(x, y)
- return self.X <= x and x <= self.X + self.Width - 1 and self.Y <= y and y <= self.Y + self.Height - 1
- end
- function gui.GetCenterSegment(l, r, width)
- return math.floor((l + r - (width or 0) + 1) / 2)
- end
- function gui.GetCenter(sX, sWidth, width)
- return sX + math.floor((sWidth - (width or 0)) / 2)
- -- return gui.GetCenterSegment(sX, sX + sWidth - 1, width)
- end
- function gui.gc()
- for index, element in pairs(elements) do
- if type(element) == "table" and element.Garbage then
- elements[index] = nil
- end
- end
- end
- function gui.OnClick(_, _, x, y, button, name)
- gui.gc()
- for index, element in pairs(elements) do
- if type(element) == "table" and element.Enabled and type(element.OnClick) == "function" then
- -- element:OnClick(x, y)
- pcall(element.OnClick, element, x, y, button, name)
- end
- end
- for index, element in pairs(elements) do
- if type(element) == "table" and element.Enabled and type(element.IsClicked) == "function" and type(element.OnElementClick) == "function" and element:IsClicked(x, y) then
- -- element:OnElementClick(x - element.X + 1, y - element.Y + 1)
- pcall(element.OnElementClick, element, x - element.X + 1, y - element.Y + 1, button, name)
- break
- end
- end
- end
- function gui.OnKeyDown(_, _, key1, key2, name)
- gui.gc()
- for index, element in pairs(elements) do
- if type(element) == "table" and element.Enabled and element.Focused and type(element.OnKeyDown) == "function" then
- -- element:OnKeyDown(key1, key2, name)
- pcall(element.OnKeyDown, element, key1, key2, name)
- end
- end
- end
- function gui.OnKeyUp(_, _, key1, key2, name)
- gui.gc()
- for index, element in pairs(elements) do
- if type(element) == "table" and element.Enabled and element.Focused and type(element.OnKeyUp) == "function" then
- -- element:OnKeyDown(key1, key2, name)
- pcall(element.OnKeyUp, element, key1, key2, name)
- end
- end
- end
- -- OnScroll
- -- OnDrag
- -- OnDrop
- -- OnClipboard
- -- OnScreenResized
- function gui.Init()
- if IsInited then
- return false
- end
- IsInited = true
- elements = {}
- timers = {}
- event.listen("touch", gui.OnClick)
- event.listen("key_down", gui.OnKeyDown)
- event.listen("key_up", gui.OnKeyUp)
- end
- function gui.Destroy()
- event.ignore("touch", gui.OnClick)
- event.ignore("key_down", gui.OnKeyDown)
- event.ignore("key_up", gui.OnKeyUp)
- IsInited = false
- for index, timer in pairs(timers) do
- event.cancel(timer)
- end
- timers = nil
- for index, element in pairs(elements) do
- if type(element) == "table" and type(element.Destroy) == "function" then
- -- element:Destroy()
- pcall(element.Destroy, element)
- end
- end
- elements = nil
- -- WorkingSpaceStack = nil
- -- _G.guiDestroy = nil
- end
- -- function gui.CreateWorkingSpace()
- -- local LocalGUI = {elements = nil}
- -- return
- -- end
- -- function _G.guiDestroy()
- -- gui.Destroy()
- -- end
- function gui.Create(element)
- if type(element) ~= "table" then
- return {}
- end
- if type(element.Destroy) ~= "function" then
- element.Destroy = function(self)
- if type(self.Disable) == "function" then
- self:Disable()
- end
- self.Garbage = true
- end
- end
- if type(element.Enabled) ~= "boolean" then
- element.Enabled = false
- end
- if type(element.Enable) ~= "function" then
- element.Enable = function(self) self.Enabled = true; return self end
- end
- if type(element.Disable) ~= "function" then
- element.Disable = function(self) self.Enabled = false; return self end
- end
- if type(element.Init) ~= "function" then
- element.Init = function(self) return self end
- end
- if type(element.Paint) ~= "function" then
- element.Paint = function(self)
- if type(self.OnPaint) == "function" then
- self:OnPaint()
- end
- return self
- end
- end
- if type(element.Modify) ~= "function" then
- element.Modify = function(self, tbl)
- for index, element in pairs(tbl) do
- self[index] = element
- end
- return self
- end
- end
- if type(element.X) ~= "number" then
- element.X = 1
- end
- if type(element.Y) ~= "number" then
- element.Y = 1
- end
- if type(element.Width) ~= "number" then
- element.Width = 1
- end
- if type(element.Height) ~= "number" then
- element.Height = 1
- end
- if type(element.Focused) ~= "boolean" then
- element.Focused = false
- end
- table.insert(elements, element)
- return element
- end
- -- Group --
- function gui.CreateGroup(group, elements, x, y, width, height)
- if type(group) ~= "table" then
- group = {}
- end
- group.X = x or 1
- group.Y = y or 1
- group.Width = width or 1
- group.Height = height or 1
- if type(group.Init) ~= "function" then
- group.Init = function(self)
- for index, element in pairs(self.Elements) do
- if type(element) == "table" and type(element.Init) == "function" then
- element.X = element.X + self.X - 1
- element.Y = element.Y + self.Y - 1
- element.Parent = self
- element:Init()
- end
- end
- return self
- end
- end
- if type(group.Enabled) ~= "boolean" then
- group.Enabled = false
- end
- if type(group.Paint) ~= "function" then
- group.Paint = function(self)
- if type(self.OnPaint) == "function" then
- self:OnPaint()
- end
- for index, element in pairs(self.Elements) do
- if type(element) == "table" and type(element.Paint) == "function" then
- element:Paint()
- end
- end
- return self
- end
- end
- if type(group.Enable) ~= "function" then
- group.Enable = function(self)
- for index, element in pairs(self.Elements) do
- if type(element) == "table" and type(element.Enable) == "function" then
- element:Enable()
- end
- end
- self.Enabled = true
- return self
- end
- end
- if type(group.Disable) ~= "function" then
- group.Disable = function(self)
- for index, element in pairs(self.Elements) do
- if type(element) == "table" and type(element.Disable) == "function" then
- element:Disable()
- end
- end
- self.Enabled = false
- return self
- end
- end
- if type(group.Destroy) ~= "function" then
- group.Destroy = function(self)
- for index, element in pairs(self.Elements) do
- if type(element) == "table" and type(element.Destroy) == "function" then
- element:Destroy()
- end
- end
- self = nil
- end
- end
- group.Elements = elements
- if type(group.Elements) ~= "table" then
- group.Elements = {}
- end
- return group
- end
- --~Group~--
- gui.backend = {}
- -- Text --
- gui.backend.Text = {}
- local text = gui.backend.Text
- function text:Paint()
- gpu.setBackground(self.BackColor)
- gpu.setForeground(self.TextColor)
- if self.Width > 0 then
- -- gpu.set(self.X + math.floor(self.Width / 2) - math.ceil(unicode.len(self.Text) / 2), self.Y, self.Text)
- gpu.set(self.X + math.floor((self.Width - self.PaintedTextLen) / 2), self.Y, string.rep(" ", self.PaintedTextLen))
- gpu.set(self.X + math.floor((self.Width - unicode.len(self.Text)) / 2), self.Y, self.Text)
- else
- gpu.set(self.X, self.Y, string.rep(" ", self.PaintedTextLen))
- gpu.set(self.X, self.Y, self.Text)
- end
- self.PaintedTextLen = unicode.len(self.Text)
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- return self
- end
- function text:Create(x, y, width, text)
- return gui.Create{
- X = x,
- Y = y,
- Width = width or 0,
- Paint = self.Paint,
- Text = text,
- PaintedTextLen = 0,
- BackColor = 0x000000,
- TextColor = 0xffffff,
- }
- end
- -- Button --
- gui.backend.Button = {}
- local button = gui.backend.Button
- function button:Paint(pressed)
- gpu.setBackground(self.BackColor)
- gpu.setForeground(self.TextColor)
- gpu.fill(self.X, self.Y, self.Width, self.Height, " ")
- gpu.set(self.X + math.floor(self.Width / 2) - math.ceil(unicode.len(self.Text) / 2), self.Y + math.floor(self.Height / 2), self.Text)
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- return self
- end
- function button:Create(x, y, width, height, text, onclick)
- return gui.Create{
- OnElementClick = onclick,
- Paint = self.Paint,
- IsClicked = gui.IsClicked,
- Text = text,
- X = x,
- Y = y,
- Width = width,
- Height = height,
- BackColor = 0x666666,
- TextColor = 0xffffff,
- }
- end
- -- TextBox --
- gui.backend.TextBox = {}
- local textbox = gui.backend.TextBox
- function textbox:Init()
- self.Timer = event.timer(0.5, function()
- if self.Enable and self.Focused then
- self.Blink = not self.Blink
- self:Paint()
- end
- end, math.huge)
- table.insert(timers, self.Timer)
- end
- function textbox:Destroy()
- event.cancel(self.Timer)
- end
- function textbox:OnClick(x, y)
- self.Focused = false
- self.Blink = false
- self:Paint()
- end
- function textbox:OnElementClick(x, y)
- self.Focused = true
- if self.Focused then
- self.CursorPosition = math.min(math.max(1, x), unicode.len(self.Text) + 1)
- self:Paint()
- end
- return self
- end
- function textbox:OnKeyDown(key1, key2)
- if key1 == 8 then -- BackSpace
- if self.CursorPosition > 1 then
- self.Text = unicode.sub(self.Text, 1, self.CursorPosition - 2) .. unicode.sub(self.Text, self.CursorPosition, unicode.len(self.Text))
- self.CursorPosition = self.CursorPosition - 1
- end
- elseif key2 == 211 then -- Delete
- if self.CursorPosition <= unicode.len(self.Text) then
- self.Text = unicode.sub(self.Text, 1, self.CursorPosition - 1) .. unicode.sub(self.Text, self.CursorPosition + 1, unicode.len(self.Text))
- end
- elseif key2 == 199 then -- Home
- self.CursorPosition = 1
- elseif key2 == 207 then -- End
- self.CursorPosition = unicode.len(self.Text) + 1
- elseif key2 == 203 then -- Left
- self.CursorPosition = math.max(self.CursorPosition - 1, 1)
- elseif key2 == 205 then -- Right
- self.CursorPosition = math.min(self.CursorPosition + 1, unicode.len(self.Text) + 1)
- elseif key1 ~= 0 and (not self.AvailableChars or self.AvailableChars:find(unicode.char(key1))) then
- self.Text = unicode.sub(self.Text, 1, self.CursorPosition - 1) .. unicode.char(key1) .. unicode.sub(self.Text, self.CursorPosition, unicode.len(self.Text))
- self.CursorPosition = self.CursorPosition + 1
- end
- self:Paint()
- end
- function textbox:Paint()
- gpu.setBackground(self.BackColor)
- gpu.setForeground(self.TextColor)
- gpu.set(self.X, self.Y, string.rep(" ", self.Width))
- gpu.set(self.X, self.Y, unicode.sub(self.Text, 1, self.Width)) -- TODO normal cut
- if self.Blink and self.CursorPosition <= self.Width then
- gpu.setBackground(self.TextColor)
- gpu.setForeground(self.BackColor)
- gpu.set(self.X + self.CursorPosition - 1, self.Y, self.CursorPosition <= #self.Text and unicode.sub(self.Text, self.CursorPosition, self.CursorPosition) or " ")
- end
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- return self
- end
- function textbox:Create(x, y, width, text, availableChars)
- return gui.Create{
- Init = self.Init,
- Destroy = self.Destroy,
- OnClick = self.OnClick,
- OnElementClick = self.OnElementClick,
- OnKeyDown = self.OnKeyDown,
- Paint = self.Paint,
- IsClicked = gui.IsClicked,
- Text = text,
- AvailableChars = availableChars,
- CursorPosition = 0,
- BackColor = 0x333333,
- TextColor = 0xffffff,
- X = x,
- Y = y,
- Width = width,
- Height = 1,
- }
- end
- -- CheckBox --
- gui.backend.CheckBox = {}
- local checkbox = gui.backend.CheckBox
- function checkbox:Init()
- -- print("O")os.sleep(1)
- if self.Width == 0 then
- -- print("!")os.sleep(1)
- self.Width = 4 + unicode.len(self.Text)
- end
- -- print(self.Width)os.sleep(1)
- end
- function checkbox:Paint()
- gpu.setBackground(self.BackColor)
- gpu.setForeground(self.TextColor)
- local box = "[ ] "
- if self.Checked then
- box = "[X] "
- end
- gpu.set(self.X, self.Y, unicode.sub(box .. self.Text, 1, self.Width) .. string.rep(" ", self.Width - box:len() - self.Text:len()))
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- return self
- end
- function checkbox:OnElementClick(x, y)
- self.Checked = not self.Checked
- if type(self.OnCheckedChanged) == "function" then
- pcall(self.OnCheckedChanged, self)
- end
- self:Paint()
- end
- function checkbox:Create(x, y, width, text, checked)
- return gui.Create{
- Init = self.Init,
- IsClicked = gui.IsClicked,
- OnElementClick = self.OnElementClick,
- -- OnCheckedChanged
- Paint = self.Paint,
- X = x,
- Y = y,
- Width = width,
- Text = text,
- BackColor = 0x000000, -- 0x333333,
- TextColor = 0xffffff,
- Checked = checked or false,
- }
- end
- -- RadioButton --
- gui.backend.RadioButton = {}
- local radiobutton = gui.backend.RadioButton
- function radiobutton:Paint()
- gpu.setBackground(self.BackColor)
- gpu.setForeground(self.TextColor)
- local box = "( ) "
- if self.Checked then
- box = "(X) "
- end
- gpu.set(self.X, self.Y, unicode.sub(box .. self.Text, 1, self.Width) .. string.rep(" ", self.Width - box:len() - self.Text:len()))
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- return self
- end
- function radiobutton:OnAnotherChecked()
- self.Checked = false
- end
- function radiobutton:OnElementClick(x, y)
- self.Checked = true
- if type(self.Parent) == "table" then
- self.Parent:OnChecked(self.Name)
- else
- self:Paint()
- end
- end
- function radiobutton:Create(x, y, width, text)
- return gui.Create{
- IsClicked = gui.IsClicked,
- OnElementClick = self.OnElementClick,
- OnAnotherChecked = self.OnAnotherChecked,
- Paint = self.Paint,
- X = x,
- Y = y,
- Width = width,
- Text = text,
- BackColor = 0x000000, -- 0x333333,
- TextColor = 0xffffff,
- Checked = true,
- }
- end
- -- RadioGroup --
- gui.backend.RadioGroup = {}
- local radiogroup = gui.backend.RadioGroup
- function radiogroup:Init()
- if self.Checked == nil then
- self.Checked = next(self.Elements)
- end
- for index, element in pairs(self.Elements) do
- element.Parent = self
- element.Name = index
- if self.Checked ~= index then
- element.Checked = false
- end
- element:Init()
- end
- return self
- end
- function radiogroup:OnChecked(name)
- self.Checked = name
- for index, element in pairs(self.Elements) do
- if type(element) == "table" then
- if index ~= name then
- element:OnAnotherChecked()
- end
- element:Paint()
- end
- end
- end
- function radiogroup:Create(elements, checked)
- return gui.CreateGroup({
- Init = self.Init,
- OnChecked = self.OnChecked,
- Checked = checked,
- }, elements)
- end
- -- MessageBox --
- gui.backend.MessageBox = {}
- local msgbox = gui.backend.MessageBox
- function msgbox:Init()
- local widthScreen, heightScreen = gpu.getResolution()
- widthScreen = self.ScreenWidth or widthScreen
- heightScreen = self.ScreenHeight or heightScreen
- self.Width = math.max(self.Width, unicode.len(self.Title) + 2, unicode.len(self.Text) + 2)
- self.X = gui.GetCenter(1, widthScreen , self.Width)
- self.Y = gui.GetCenter(1, heightScreen, self.Height)
- -- self.X = math.floor((widthScreen - self.Width ) / 2) + 1
- -- self.Y = math.floor((heightScreen - self.Height) / 2) + 1
- self.Elements = gui.CreateGroup(nil,
- {
- Title = gui.backend.Text:Create(self.X, self.Y + 1, self.Width, self.Title):Modify{TextColor = self.TitleColor, BackColor = self.BackColor},
- Text = gui.backend.Text:Create(self.X, self.Y + 3, self.Width, self.Text):Modify{TextColor = self.TextColor, BackColor = self.BackColor},
- Button = gui.backend.Button:Create(self.X, self.Y + 5, self.Width, 3, "OK", function()
- if type(self.ButtonHandle) == "function" then
- self:ButtonHandle()
- end
- self:Destroy()
- end):Modify{BackColor = self.ButtonColor},
- }):Init():Enable()
- return self
- end
- function msgbox:Destroy()
- self.Elements:Destroy()
- self.Garbage = true
- end
- function msgbox:Paint()
- -- local x,y=(cfg.MapWidth-6)/((cfg.SuperQuality and 2)or 1),(math.floor(cfg.MapHeight/2)-3)/((cfg.SuperQuality and 2)or 1)
- gpu.setBackground(self.BackColor)
- gpu.fill(self.X, self.Y, self.Width, 5, " ")
- self.Elements:Paint()
- return self
- end
- function msgbox:Create(title, text, buttonText)
- return gui.Create{
- Init = self.Init,
- Destroy = self.Destroy,
- Paint = self.Paint,
- X = 0,
- Y = 0,
- Width = 10,
- Height = 8,
- Title = title or "Error",
- Text = text or "oops...",
- ButtonText = buttonText or "OK",
- TitleColor = 0xff0000,
- TextColor = 0x000000,
- BackColor = 0xffffff,
- ButtonColor = 0xff0000,
- -- ButtonHandle
- }
- end
- function gui.Error(text)
- return gui.backend.MessageBox:Create(nil, text):Init():Paint()
- end
- -- Canvas --
- gui.backend.Canvas = {}
- local canvas = gui.backend.Canvas
- function canvas.GetOffsetFunction(func, ...)
- local offset = {...}
- return function(...)
- local args = {...}
- for index, value in pairs(offset) do
- args[index] = args[index] + value
- end
- return func(table.unpack(args))
- end
- end
- function canvas:Init()
- self.get = canvas.GetOffsetFunction(gpu.get, self.X - 1, self.Y - 1)
- self.set = canvas.GetOffsetFunction(gpu.set, self.X - 1, self.Y - 1)
- self.fill = canvas.GetOffsetFunction(gpu.fill, self.X - 1, self.Y - 1)
- self.copy = canvas.GetOffsetFunction(gpu.copy, self.X - 1, self.Y - 1)
- end
- function canvas:Paint()
- gpu.setBackground(self.BackColor)
- self.fill(1, 1, self.Width, self.Height, " ")
- if type(self.OnPaint) == "function" then
- self:OnPaint()
- end
- end
- function canvas:Create(x, y, width, height)
- return gui.Create{
- Paint = self.Paint,
- Init = self.Init,
- IsClicked = gui.IsClicked,
- X = x,
- Y = y,
- Width = width,
- Height = height,
- BackColor = 0x000000,
- }
- end
- -- Form --
- gui.backend.Form = {}
- local form = gui.backend.Form
- function form:Init()
- for _, element in pairs(self.Elements) do
- -- element.X = element.X + self.X - 1
- -- element.Y = element.Y + self.Y - 1
- element.Parent = self
- element:Init()
- end
- return self
- end
- function form:Paint(NoClear)
- if type(self.OnPaint) == "function" then
- self:OnPaint()
- end
- if not NoClear then
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- width, height = gpu.getResolution()
- gpu.fill(1, 1, width, height, " ")
- pcall(gpu.setResolution, self.Width, self.Height)
- end
- for index, element in pairs(self.Elements) do
- element:Paint()
- end
- return self
- end
- function form:Show()
- if type(self.OnEnable) == "function" then
- pcall(self.OnEnable, self)
- end
- for index, element in pairs(self.Elements) do
- element:Enable()
- end
- self.Enabled = true
- return self
- end
- function form:Hide(NoClear)
- if type(self.OnDisable) == "function" then
- pcall(self.OnDisable, self)
- end
- for _, element in pairs(self.Elements) do
- element:Disable()
- end
- if not NoClear then
- gpu.setResolution(gpu.maxResolution())
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- width, height = gpu.getResolution()
- gpu.fill(1, 1, width, height, " ")
- end
- self.Enabled = false
- return self
- end
- function form:Destroy()
- self:Disable()
- for _, element in pairs(self.Elements) do
- if type(element) == "table" and type(element.Destroy) == "function" then
- element:Destroy()
- end
- end
- self.Garbage = true
- end
- function form:Create(width, height, elements)
- return gui.Create{
- Enable = self.Show,
- Disable = self.Hide,
- Destroy = self.Destroy,
- Paint = self.Paint,
- Init = self.Init,
- Width = width,
- Height = height,
- Elements = elements,
- }
- end
- return gui --[[
- ---------------------------------------------------------
- gui.Init()
- ScoresForm = gui.backend.Form:Create(20, 20,
- {
- gui.backend.TextBox:Create(1, 1, 10, "YourфText"),
- gui.backend.CheckBox:Create(1, 3, 20, "всё ок?"),
- TMP = gui.backend.RadioGroup:Create
- {
- qm = gui.backend.RadioButton:Create(1, 5, 20, "QWERTYмэн"),
- q2 = gui.backend.RadioButton:Create(2, 6, 10, "Qмэн"),
- },
- gui.backend.Button:Create(1, 18, 20, 3, "Back", function()
- print(ScoresForm.Elements["TMP"].Checked) os.sleep(1)
- ScoresForm:Disable(true)
- MainForm:Enable():Paint()
- end),
- }
- ):Init()
- SettingsForm = gui.backend.Form:Create(20, 17,
- {
- gui.backend.Text:Create(1, 1, 20, "Settings"),
- gui.backend.Text:Create(1, 3, nil, "Width"),
- Width = gui.backend.TextBox:Create(1, 4, 20, "0", "0123456789"),
- gui.backend.Text:Create(1, 6, nil, "Height"),
- Height = gui.backend.TextBox:Create(1, 7, 20, "0", "0123456789"),
- SQ = gui.backend.CheckBox:Create(1, 9, 20, "Super Quality"),
- gui.backend.Text:Create(1, 11, nil, "Map Generation Mode"),
- Mode = gui.backend.RadioGroup:Create
- {
- gui.backend.RadioButton:Create(1, 12, 20, "Recursive"),
- gui.backend.RadioButton:Create(1, 13, 20, "Hunt&Kill"),
- },
- gui.backend.Button:Create(1, 15, 20, 3, "Back", function()
- -- print(SettingsForm.Elements["Mode"].Checked) os.sleep(1)
- -- print(SettingsForm.Elements["SQ"].Checked) os.sleep(1)
- -- print(SettingsForm.Elements["Width"].Text) os.sleep(1)
- SettingsForm:Disable(true)
- MainForm:Enable():Paint()
- end),
- }
- ):Init()
- MainForm = gui.backend.Form:Create(20, 15,
- {
- gui.backend.Button:Create(1, 1, 20, 3, "New Game", function() MainForm:Disable(true) quit = true end),
- gui.backend.Button:Create(1, 5, 20, 3, "High Scores", function()
- MainForm:Disable(true) --error("!")
- ScoresForm:Enable():Paint()
- end),
- gui.backend.Button:Create(1, 9, 20, 3, "Settings", function()
- MainForm:Disable(true)
- SettingsForm:Enable():Paint()
- end),
- gui.backend.Button:Create(1, 13, 20, 3, "Exit", function() quit = true end),
- }
- )
- MainForm:Init():Enable():Paint()
- Err = gui.backend.MessageBox:Create():Init():Paint()
- gui.Error("GG!")
- -- gui.backend.MessageBox:Create("congratulation","You Win!"):Modify{ButtonHandle = function() print("HANDLED") end}:Init():Paint()
- eoe = event.onError
- event.onError = function(...)
- quit = true
- print("event error") os.sleep(1)
- return eoe(...)
- end
- quit = false
- pcall(function()
- while not quit do
- event.pull()
- end
- end)
- event.onError = eoe
- -- print(SettingsForm.Elements["Width"].Text, SettingsForm.Elements["Height"].Text) os.sleep(1)
- gui.Destroy()
- --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement