feat: add everything needed for fancymenus
This commit is contained in:
parent
ae13c1d5ae
commit
4daa0b16eb
2 changed files with 14 additions and 9 deletions
|
@ -79,24 +79,25 @@ end
|
||||||
-- DRAW FUNCTIONS
|
-- DRAW FUNCTIONS
|
||||||
-- draw the menu and the rest of content.
|
-- draw the menu and the rest of content.
|
||||||
|
|
||||||
|
function ListBox:getListPart(relativeNumber)
|
||||||
|
return 0, (relativeNumber) * self.widgetSize.h, self.w, self.widgetSize.h
|
||||||
|
end
|
||||||
|
|
||||||
function ListBox:drawTexture()
|
function ListBox:drawTexture()
|
||||||
self.view:updateFirstSlot(self.widget:getSelected())
|
self.view:updateFirstSlot(self.widget:getSelected())
|
||||||
local widgety = self.canvas.padding
|
|
||||||
|
|
||||||
local listWidget = self.widget:getList(self.view.firstSlot, self.view.slotNumber)
|
local listWidget = self.widget:getList(self.view.firstSlot, self.view.slotNumber)
|
||||||
|
|
||||||
for _, widget in ipairs(listWidget) do
|
for i, widget in ipairs(listWidget) do
|
||||||
widget:drawWidget(self.canvas.padding, widgety, self.w, self.widgetSize.h)
|
local x, y, w, h = self:getListPart(i - 1)
|
||||||
widgety = widgety + self.widgetSize.h
|
self:drawWidgetBackground(x + self.canvas.padding, y + self.canvas.padding, w, h)
|
||||||
|
widget:drawWidget(x + self.canvas.padding, y + self.canvas.padding, w, h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListBox:getGraphicalCursorPosition()
|
function ListBox:getGraphicalCursorPosition()
|
||||||
self.view:updateFirstSlot(self.widget:getSelected())
|
local x, y, w, h = self:getListPart(self.widget:getSelected() - self.view.firstSlot)
|
||||||
local w, h = self:getWidgetSize()
|
|
||||||
local y = (self.widget:getSelected() - self.view.firstSlot) * h
|
|
||||||
|
|
||||||
return self.x - self.ox,self.y + y - self.oy, w, h
|
return self.x - self.ox + x,self.y + y - self.oy, w, h
|
||||||
end
|
end
|
||||||
|
|
||||||
return ListBox
|
return ListBox
|
||||||
|
|
|
@ -166,6 +166,10 @@ function Menu:drawCanvas()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Menu:drawWidgetBackground(x, y, w, h)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- WIDGET FUNCTIONS
|
-- WIDGET FUNCTIONS
|
||||||
-- Handle widgets of the functions
|
-- Handle widgets of the functions
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue