show icon in closed dropdown

This commit is contained in:
jill 2021-09-18 13:23:20 +03:00
parent df3bfb150a
commit 033ea73c28

View file

@ -177,7 +177,14 @@ function self.render()
love.graphics.setColor(1, 1, 1, 1)
love.graphics.rectangle('line', x, y, w, h)
love.graphics.print(self.selected(i), x + margin/2, y + margin/2)
if v.icons and v.icons[v.selected] then
local sprite = icon[v.icons[v.selected]]
love.graphics.draw(sprite, x + 2, y + 2, 0, fontHeight / sprite:getWidth(), fontHeight / sprite:getHeight())
love.graphics.print(self.selected(i), x + margin/2 + fontHeight, y + margin/2)
else
love.graphics.print(self.selected(i), x + margin/2, y + margin/2)
end
-- love.graphics.rectangle('line', x + w - h, y, h, h)
love.graphics.setLineWidth(1)
love.graphics.polygon('line', x + w - h/2 + 0.3 * h, y + h/2 - 0.3 * h, x + w - h/2 - 0.3 * h, y + h/2 - 0.3 * h, x + w - h/2, y + h/2 + 0.3 * h)