Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Nabeel20/Badar
๐ Declarative, retained* and flexbox inspired UI library for Lรถve2D
https://github.com/Nabeel20/Badar
gui love2d lua
Last synced: about 2 months ago
JSON representation
๐ Declarative, retained* and flexbox inspired UI library for Lรถve2D
- Host: GitHub
- URL: https://github.com/Nabeel20/Badar
- Owner: Nabeel20
- License: mit
- Created: 2024-04-09T05:33:40.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-05-10T11:59:12.000Z (about 2 months ago)
- Last Synced: 2024-05-10T20:58:07.663Z (about 2 months ago)
- Topics: gui, love2d, lua
- Language: Lua
- Homepage:
- Size: 147 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-love2d - Badar ๐ - Declarative, retained\* and flexbox inspired UI library and components. (UI)
README
# Badar ๐
Badar _(Full moon in Arabic)_ is a declarative, retained\* and flexbox inspired ui library, with focus on reactivity and composition in mind.
### Getting Started
Badar adapts the `lรถve2d` mentality. You can define a variable in `love.load`, and invoke `render` in `love.draw`. Other callback functions (e.g, `mousepressed`, `mousemoved`) are used in the same manner.
- [API](docs/Core.md)
- [Components โจ](components)### Usage
```lua
function love.load()
local container = require 'path.to.badar.lua'
local button = require 'components.button'
local text = require 'components.text'local counter = text(0)
main = container({ width = screenWidth, height = screenHeight })
.style({ padding = { 16, 16, 16, 16 } })
.content({
counter,
button('add').onClick(function()
counter.text = counter.text + 1
end)
}, { direction = 'column', gap = 8 })
endfunction love.draw()
main.render()
endfunction love.mousepressed(x, y, button, istouch)
main.mousepressed(button) -- only mouse button needed
end
```## License
This library is free software; you can redistribute it and/or modify it under
the terms of the MIT license. See [LICENSE](LICENSE) for details.