Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KINGTUT10101/TuxRedux
An immediate-mode UI system for LOVE2D inspired by SUIT.
https://github.com/KINGTUT10101/TuxRedux
Last synced: 25 days ago
JSON representation
An immediate-mode UI system for LOVE2D inspired by SUIT.
- Host: GitHub
- URL: https://github.com/KINGTUT10101/TuxRedux
- Owner: KINGTUT10101
- License: mit
- Created: 2024-06-19T00:14:59.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-29T01:42:42.000Z (3 months ago)
- Last Synced: 2024-11-20T22:14:27.601Z (about 2 months ago)
- Language: Lua
- Size: 104 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - TuxRedux (⭐1) - An immediate-mode UI system for LOVE2D inspired by SUIT. (Recently Updated / [Aug 30, 2024](/content/2024/08/30/README.md))
README
## TuxRedux
> **NOTE: This project is still in early development and is lacking documentation. It will be developed over time as I finish up Just Another Sand Game v1.0**
Tux Redux is an immediate-mode UI system for LOVE2D inspired by [SUIT](https://github.com/vrld/suit). It is a continuation of my original extension to SUIT called [Tux](https://github.com/KINGTUT10101/tux/tree/master).
If you'd like an example of Tux Redux in action, check out my weekend game jam project, [Verify You're Human](https://github.com/KINGTUT10101/VerifyYoureHuman).
![image](https://github.com/user-attachments/assets/b011325a-9cfd-4a6d-8b05-c4199ef9fcf5)
```lua
local tux = require ("tux")local checkboxData = {checked = false}
local checkColor = {
on = {0, 1, 0, 1},
off = {1, 0, 0, 1},
}
local sliderData = {value = 0}
local singleInputData = {
text = "First data",
inFocus = false,
}function love.update (dt)
tux.callbacks.update (dt)tux.show.label ({colors = {1, 0, 0, 1},}, 100, 100, 250, 100)
tux.show.label ({
colors = {1, 0, 1, 1},
tooltip = {
text = "This is a test"
}
}, 150, 150, 250, 100)if tux.show.button (nil, 400, 300, 100, 200) == "end" then
print ("end")
end
if tux.show.button (nil, 450, 350, 100, 200) == "start" then
print ("start")
endtux.show.noPressZone (nil, 550, 100, 100, 100)
if tux.show.button (nil, 600, 150, 100, 200) == "held" then
print ("held")
endif tux.show.button ({text="Debug mode"}, 25, 525, 50, 50) == "start" then
tux.utils.setDebugMode (not tux.utils.getDebugMode ())
end
tux.show.checkbox ({data = checkboxData, mark = "cross"}, 500, 25, 100, 50)tux.show.toggle ({data = checkboxData, checkColor = checkColor, style = "round"}, 25, 350, 50, 50)
tux.show.slider ({data = sliderData}, 150, 300, 200, 50)
tux.show.label ({
text = math.floor (sliderData.value * 100) / 100,
colors = {1, 0, 1, 1},
}, 25, 25, 50, 25)tux.show.singleInput ({data = singleInputData}, 150, 400, 200, 50)
endfunction love.draw ()
tux.callbacks.draw ()-- Prints the cursor coordinates
local mx, my = love.mouse.getPosition ()
love.graphics.setColor (1, 1, 1, 1)
love.graphics.print (mx .. ", " .. my, 700, 25)-- Prints the current debug mode
love.graphics.print ("Debug: " .. tostring (tux.utils.getDebugMode ()), 700, 50)
endfunction love.textinput (text)
tux.callbacks.textinput (text)
endfunction love.keypressed (key, scancode, isrepeat)
tux.callbacks.keypressed (key, scancode, isrepeat)
end
```### Project Goals
The following is a list of goals that I intend to fulfill with this project in the future:
* A familiar and intuitive interface inspired by SUIT
* UI components can be be shown by simply executing a function
* The state of the UI component is returned as a string and can be easily integrated with your existing logic
* Better documentation and more examples
* More base components
* Multiline text fields
* Toggle switches
* Drop-downs
* New UI options
* Icon support
* Padding
* Nineslices
* Better text alignment
* Automatic font sizing
* Improved layout system
* High extensibility
* New components only require a couple functions and attributes to create
* Registering components is as easy as calling tux.utils.register
* Internal rendering behavior is easily accessible/replaceable and well-documented