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()
|
||||
|
||||
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_hor = slots_hor
|
||||
self.slots_vert = slots_vert
|
||||
ListBox.super.new(self, menusystem, name, x, y, w, h)
|
||||
self.begin = 1
|
||||
self.widget.h = math.floor( self.h / slots_vert )
|
||||
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
|
||||
|
||||
function FlowBox:updateWidgetSize()
|
||||
self.widget.h = math.floor( self.h / slots_vert )
|
||||
self.widget.w = math.floor( self.w / slots_hor )
|
||||
self.widget.h = math.floor( self.h / self.slots_vert )
|
||||
self.widget.w = math.floor( self.w / self.slots_hor )
|
||||
end
|
||||
|
||||
function FlowBox:update(dt)
|
||||
|
|
|
@ -5,10 +5,10 @@ local Menu = require(cwd .. "parent")
|
|||
GridBox = Menu:extend()
|
||||
|
||||
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_hor = slots_hor
|
||||
self.slots_vert = slots_vert
|
||||
GridBox.super.new(self, menusystem, name, x, y, w, h)
|
||||
self.begin = 1
|
||||
self.h = slots_vert * self.widget.h -- On fait en sorte que la hauteur
|
||||
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
|
||||
|
||||
function GridBox:updateWidgetSize()
|
||||
self.widget.h = math.floor( self.h / slots_vert )
|
||||
self.widget.w = math.floor( self.w / slots_hor )
|
||||
self.widget.h = math.floor( self.h / self.slots_vert )
|
||||
self.widget.w = math.floor( self.w / self.slots_hor )
|
||||
end
|
||||
|
||||
function GridBox:update(dt)
|
||||
|
|
|
@ -4,15 +4,15 @@ local Menu = require(cwd .. "parent")
|
|||
ListBox = Menu:extend()
|
||||
|
||||
function ListBox:new(menusystem, name, x, y, w, h, slots)
|
||||
ListBox.super.new(self, menusystem, name, x, y, w, h)
|
||||
self.slots = slots
|
||||
ListBox.super.new(self, menusystem, name, x, y, w, h)
|
||||
self.begin = 1
|
||||
self.h = slots * self.widget.h -- On fait en sorte que la hauteur
|
||||
-- soit un multiple du nombre de slot et de leur hauteur
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@ local Menu = require(cwd .. "parent")
|
|||
local TextMenu = Menu:extend()
|
||||
|
||||
function TextMenu:new(menusystem, name, x, y, font, slots)
|
||||
self.slots = slots
|
||||
TextMenu.super.new(self, menusystem, name, x, y, 0, 0)
|
||||
self.ox = x
|
||||
self.oy = y
|
||||
self.font = font
|
||||
self.align = "left"
|
||||
|
||||
self.slots = slots
|
||||
self.begin = 1
|
||||
|
||||
self:getBoundingBox()
|
||||
|
|
Loading…
Reference in a new issue