2021-08-31 19:12:40 +02:00
|
|
|
local ParentMenu = require "birb.modules.gui.textmenu"
|
|
|
|
local BoxedList = ParentMenu:extend()
|
|
|
|
|
|
|
|
local gui = require "game.modules.gui"
|
|
|
|
|
|
|
|
function BoxedList:new(name, x, y, w, slotNumber, isBoxed, smallborder)
|
|
|
|
BoxedList.super.new(self, name, "small", x, y, w, slotNumber, 0)
|
|
|
|
self.paddingLeft = 12
|
2022-01-05 18:26:05 +01:00
|
|
|
self.paddingRight = 6
|
2022-01-02 15:18:23 +01:00
|
|
|
self.canvas.padding = 24
|
2021-08-31 19:12:40 +02:00
|
|
|
|
|
|
|
self.cursorTexture = love.graphics.newImage("assets/gui/cursor-menulist.png")
|
|
|
|
self.cursorTransition = 0
|
|
|
|
|
|
|
|
self.isBoxed = isBoxed
|
2022-01-05 18:26:05 +01:00
|
|
|
self.border = utils.math.either(smallborder, 8, 16)
|
|
|
|
self.box = gui.newTextBox("assets/gui/dialogbox.png", self.w, self.h + self.border)
|
2021-08-31 19:12:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function BoxedList:finalize()
|
|
|
|
self:setCancelWidget()
|
|
|
|
end
|
|
|
|
|
|
|
|
function BoxedList:update(dt)
|
|
|
|
BoxedList.super.update(self, dt)
|
|
|
|
end
|
|
|
|
|
2022-01-02 15:18:23 +01:00
|
|
|
function BoxedList:drawTexture()
|
2021-08-31 19:12:40 +02:00
|
|
|
if (self.isBoxed) then
|
|
|
|
local w, h = self.box:getDimensions()
|
2022-01-05 18:26:05 +01:00
|
|
|
love.graphics.draw(self.box, self.canvas.padding, self.canvas.padding - self.border/2)
|
2021-08-31 19:12:40 +02:00
|
|
|
end
|
2022-01-02 15:18:23 +01:00
|
|
|
BoxedList.super.drawTexture(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
function BoxedList:drawGraphicalCursor(x, y, w, h)
|
|
|
|
love.graphics.draw(self.cursorTexture, x, y + 1)
|
2021-08-31 19:12:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return BoxedList
|