sonic-radiance/sonic-radiance.love/game/modules/gui/boxedmenu.lua

51 lines
1.3 KiB
Lua
Raw Normal View History

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
self.paddingRight = 4
self.canvas.padding = 24
self.cursorTexture = love.graphics.newImage("assets/gui/cursor-menulist.png")
self.cursorTransition = 0
self.isBoxed = isBoxed
if (isBoxed) then
local border = self.h + 16
if (smallborder == true) then
border = self.h + 8
end
self.box = gui.newTextBox("assets/gui/dialogbox.png", w + 8, border)
end
end
function BoxedList:finalize()
self:setCancelWidget()
end
function BoxedList:update(dt)
BoxedList.super.update(self, dt)
end
function BoxedList:drawTexture()
if (self.isBoxed) then
local dy = 8
if (self.smallborder) then
dy = 4
end
local w, h = self.box:getDimensions()
local diff = (w-self.w)/2
love.graphics.draw(self.box, self.canvas.padding - diff, self.canvas.padding - dy)
end
BoxedList.super.drawTexture(self)
end
function BoxedList:drawGraphicalCursor(x, y, w, h)
love.graphics.draw(self.cursorTexture, x, y + 1)
end
return BoxedList