core/menusystem: declare slots variables before calling the parent new()
This commit is contained in:
parent
e3cc372340
commit
44bf09aa88
4 changed files with 9 additions and 9 deletions
|
@ -4,10 +4,10 @@ local Menu = require(cwd .. "parent")
|
||||||
FlowBox = Menu:extend()
|
FlowBox = Menu:extend()
|
||||||
|
|
||||||
function FlowBox:new(menusystem, name, x, y, w, h, slots_hor, slots_vert)
|
function FlowBox:new(menusystem, name, x, y, w, h, slots_hor, slots_vert)
|
||||||
ListBox.super.new(self, menusystem, name, x, y, w, h)
|
|
||||||
self.slots = slots_hor * slots_vert
|
self.slots = slots_hor * slots_vert
|
||||||
self.slots_hor = slots_hor
|
self.slots_hor = slots_hor
|
||||||
self.slots_vert = slots_vert
|
self.slots_vert = slots_vert
|
||||||
|
ListBox.super.new(self, menusystem, name, x, y, w, h)
|
||||||
self.begin = 1
|
self.begin = 1
|
||||||
self.widget.h = math.floor( self.h / slots_vert )
|
self.widget.h = math.floor( self.h / slots_vert )
|
||||||
self.widget.w = math.floor( self.w / slots_hor )
|
self.widget.w = math.floor( self.w / slots_hor )
|
||||||
|
@ -17,8 +17,8 @@ function FlowBox:new(menusystem, name, x, y, w, h, slots_hor, slots_vert)
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:updateWidgetSize()
|
function FlowBox:updateWidgetSize()
|
||||||
self.widget.h = math.floor( self.h / slots_vert )
|
self.widget.h = math.floor( self.h / self.slots_vert )
|
||||||
self.widget.w = math.floor( self.w / slots_hor )
|
self.widget.w = math.floor( self.w / self.slots_hor )
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:update(dt)
|
function FlowBox:update(dt)
|
||||||
|
|
|
@ -5,10 +5,10 @@ local Menu = require(cwd .. "parent")
|
||||||
GridBox = Menu:extend()
|
GridBox = Menu:extend()
|
||||||
|
|
||||||
function GridBox:new(menusystem, name, x, y, w, h, slots_hor, slots_vert)
|
function GridBox:new(menusystem, name, x, y, w, h, slots_hor, slots_vert)
|
||||||
GridBox.super.new(self, menusystem, name, x, y, w, h)
|
|
||||||
self.slots = slots_hor * slots_vert
|
self.slots = slots_hor * slots_vert
|
||||||
self.slots_hor = slots_hor
|
self.slots_hor = slots_hor
|
||||||
self.slots_vert = slots_vert
|
self.slots_vert = slots_vert
|
||||||
|
GridBox.super.new(self, menusystem, name, x, y, w, h)
|
||||||
self.begin = 1
|
self.begin = 1
|
||||||
self.h = slots_vert * self.widget.h -- On fait en sorte que la hauteur
|
self.h = slots_vert * self.widget.h -- On fait en sorte que la hauteur
|
||||||
self.w = slots_hor * self.widget.w -- et la largeur
|
self.w = slots_hor * self.widget.w -- et la largeur
|
||||||
|
@ -30,8 +30,8 @@ function GridBox:new(menusystem, name, x, y, w, h, slots_hor, slots_vert)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GridBox:updateWidgetSize()
|
function GridBox:updateWidgetSize()
|
||||||
self.widget.h = math.floor( self.h / slots_vert )
|
self.widget.h = math.floor( self.h / self.slots_vert )
|
||||||
self.widget.w = math.floor( self.w / slots_hor )
|
self.widget.w = math.floor( self.w / self.slots_hor )
|
||||||
end
|
end
|
||||||
|
|
||||||
function GridBox:update(dt)
|
function GridBox:update(dt)
|
||||||
|
|
|
@ -4,15 +4,15 @@ local Menu = require(cwd .. "parent")
|
||||||
ListBox = Menu:extend()
|
ListBox = Menu:extend()
|
||||||
|
|
||||||
function ListBox:new(menusystem, name, x, y, w, h, slots)
|
function ListBox:new(menusystem, name, x, y, w, h, slots)
|
||||||
ListBox.super.new(self, menusystem, name, x, y, w, h)
|
|
||||||
self.slots = slots
|
self.slots = slots
|
||||||
|
ListBox.super.new(self, menusystem, name, x, y, w, h)
|
||||||
self.begin = 1
|
self.begin = 1
|
||||||
self.h = slots * self.widget.h -- On fait en sorte que la hauteur
|
self.h = slots * self.widget.h -- On fait en sorte que la hauteur
|
||||||
-- soit un multiple du nombre de slot et de leur hauteur
|
-- soit un multiple du nombre de slot et de leur hauteur
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListBox:updateWidgetSize()
|
function ListBox:updateWidgetSize()
|
||||||
self.widget.h = math.floor( self.h / slots )
|
self.widget.h = math.floor( self.h / self.slots )
|
||||||
self.widget.w = self.w
|
self.widget.w = self.w
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@ local Menu = require(cwd .. "parent")
|
||||||
local TextMenu = Menu:extend()
|
local TextMenu = Menu:extend()
|
||||||
|
|
||||||
function TextMenu:new(menusystem, name, x, y, font, slots)
|
function TextMenu:new(menusystem, name, x, y, font, slots)
|
||||||
|
self.slots = slots
|
||||||
TextMenu.super.new(self, menusystem, name, x, y, 0, 0)
|
TextMenu.super.new(self, menusystem, name, x, y, 0, 0)
|
||||||
self.ox = x
|
self.ox = x
|
||||||
self.oy = y
|
self.oy = y
|
||||||
self.font = font
|
self.font = font
|
||||||
self.align = "left"
|
self.align = "left"
|
||||||
|
|
||||||
self.slots = slots
|
|
||||||
self.begin = 1
|
self.begin = 1
|
||||||
|
|
||||||
self:getBoundingBox()
|
self:getBoundingBox()
|
||||||
|
|
Loading…
Reference in a new issue