EasyButton: Simple Lua Button Library for LÖVE2D

Welcome to EasyButton, the simplest way to add buttons to your LÖVE2D projects! EasyButton is designed for beginners and experts alike, making it super easy to create interactive buttons in your games or applications.

Integrate EasyButton into Your LÖVE2D Project

To use EasyButton, follow these steps:

1. Download EasyButton

Download the EasyButton library from the following link:

Download EasyButton

2. Add EasyButton to Your Project

Extract the downloaded EasyButton folder and add the button.lua file into your LÖVE2D project directory.

3. Require EasyButton in Your main.lua

Include EasyButton in your main.lua file to start using it:

-- main.lua
local Button = require "button"

4. Create and Use a Button

Now, create a simple button in your main.lua file:

-- main.lua
local myButton

function love.load()
    myButton = Button:new(100, 100, 200, 50, "Click Me!")
end

function love.update(dt)
    myButton:update()
    if myButton.pressed then
        print("Button was clicked!")
        myButton.pressed = false  -- Reset the pressed state
    end
end

function love.draw()
    myButton:draw()
end

Explanation:

This code sets up a button at position (100, 100) with dimensions 200x50 and a label "Click Me!". The button's state is updated in the love.update function, and it is drawn on the screen in the love.draw function.

Features and Possibilities with EasyButton

EasyButton provides several features to enhance button functionality in your LÖVE2D projects:

With these features, EasyButton simplifies the process of adding interactive buttons, making it ideal for both beginners and experienced developers.

Download

You can download the EasyButton library from the following link:

Download EasyButton