SDropdown - The library creates a simple drop-down interface for Love2d

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
lenlenlL6
Prole
Posts: 9
Joined: Tue Jul 04, 2023 3:54 pm

SDropdown - The library creates a simple drop-down interface for Love2d

Post by lenlenlL6 »

Hi guys, I just created a small library to create a dropdown, hope you guys like it :D

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
Preview

Image
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 73 guests