Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/looobay/love2d-button
A simple library for creating buttons with LÖVE 2D.
https://github.com/looobay/love2d-button
buttons love2d lua
Last synced: about 2 months ago
JSON representation
A simple library for creating buttons with LÖVE 2D.
- Host: GitHub
- URL: https://github.com/looobay/love2d-button
- Owner: Looobay
- License: mit
- Created: 2024-04-26T15:52:55.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-05-10T09:49:02.000Z (9 months ago)
- Last Synced: 2024-10-31T04:24:11.752Z (3 months ago)
- Topics: buttons, love2d, lua
- Language: Lua
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LOVE2D-button
A simple library for creating buttons with LÖVE 2D.### Little warning:
This project is not finished yet so you may encounter some bugs !## Features:
* Execute function on click
* Can easily remove buttons with `button:delete()`
* You can easily modify the code ! (because it is very lite)## How it's work:
* First step, require the librarie :
```lua
button = require "button.lua"
```* Second step, adding `button:new()` to `love.load()`, `button:update(dt)` to `love.update(dt)` and `button:draw()` to `love.draw()`.
````lua
function love.load()
button:new(--Put your button here)
endfunction love.update(dt)
button:update(dt)
endfunction love.draw()
button:draw()
end
````* Third step, create your button in `love.load()` like this:
````lua
ExampleButton = {button:new(300, 150,150,100,{1,1,1}, "Example", {0,0,0}, function()print("Example")end, false)}
````
DONT FORGET !!! -> YOUR BUTTON IS A TABLE WITH THE `button:new()` INSIDE.You can check the `example` folder to see an example LÖVE2D project with the librarie.
## Result:
![alt text](example.png)
## Other tips:
* How to use the `button:delete()` function:
````lua
button:delete(ExampleButton)
````