https://github.com/lenlenlL6/SDropdown
Demo
Code: Select all
local Font = require("font/Font")
local SDropdown = require("sdropdown")
function love.load()
w, h = love.graphics.getWidth(), love.graphics.getHeight()
love.window.setMode(w, h, {highdpi = false})
w, h = love.graphics.getWidth(), love.graphics.getHeight()
dropdown = SDropdown:new(w / 2 - 200 / 2, 100, 200, 50, {105, 105, 105}, {192, 192, 192}, 100, 40, Font.MC, {"Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6"})
end
function love.update(dt)
dropdown:update()
end
function love.draw()
love.graphics.setColor(love.math.colorFromBytes(250, 250, 210))
love.graphics.rectangle("fill", 0, 0, w, h)
love.graphics.setColor(love.math.colorFromBytes(255, 255, 255))
dropdown:draw()
end
function love.touchpressed(id, x, y)
dropdown:touchPressed(id, x, y)
end
function love.touchreleased(id, x, y)
dropdown:touchReleased(id, x, y)
end