Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Window = {
- clear = function(self)
- local x_string = ""
- for x = 1, self.width do
- x_string = x_string .. " "
- end
- for y = 1, self.heigth do
- self:setCursorPos(1,y)
- self:write(x_string)
- end
- end,
- setCursorPos = function(self, x, y)
- self.mon.setCursorPos(x+self.init_x, y+self.init_y)
- end,
- write = function (self, text)
- self.mon.write(text)
- end,
- setBackgroundColor = function(self, color)
- self.mon.setBackgroundColor(color)
- end,
- setTextColor = function(self, color)
- self.mon.setTextColor(color)
- end,
- getCursorPos = function(self)
- local x, y = self.mon.getCursorPos()
- local lx = x - self.init_x
- local ly = y - self.init_y
- return lx, ly
- end,
- getSize = function(self)
- return self.width, self.heigth
- end,
- }
- function numberBetween(v1, v2, v3)
- if v1 >= v2 and v1 <= v3 then
- return true
- end
- return false
- end
- function newWindow(mon, x, y, width, heigth)
- local max_x, max_y = mon.getSize()
- local window = {
- item = gcapi.deepCopy(row_data),
- init_x = x-1,
- init_y = y-1,
- buttons_map = {}
- }
- for x=1, max_x do
- window.buttons_map[x] = {}
- end
- window.mon = mon
- window.width = width
- window.heigth = heigth
- setmetatable(window, {__index = Window})
- return window
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement