diff --git a/dropdown.lua b/dropdown.lua index ec953c6..0ac089e 100644 --- a/dropdown.lua +++ b/dropdown.lua @@ -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)