Slab - An Immediate Mode GUI Library In Lua

Showcase your libraries, tools and other projects that help your fellow love users.
ki
Prole
Posts: 16
Joined: Tue Oct 09, 2012 10:23 am

Re: Slab - An Immediate Mode GUI Library In Lua

Post by ki »

Thank you for this library, coding.jackalope!

Here's a bug report regarding short mouse clicks. Slab doesn't register most of the clicks I do with my trackpad.

If a mouse click is very short, which means that the interval between "mouse button is pressed down" and "mouse button is released" is somewhere less than 16.66 ms (if Löve is running at 60 FPS), then Slab doesn't recognize the mouse click. This is easy to reproduce when using a trackpad, if the trackpad is configured to register a click when the user lightly taps the trackpad. When testing with macOS and an Apple trackpad, I get clicks that are only about 0,000005 seconds long, as measured by love.timer.getTime() with the callback functions love.mousepressed() and love.mousepressed().

Currently Slab only queries the state of the mouse buttons with love.mouse.isDown() on every update, and if the button was pressed and released between two updates, no click is registered. I think Slab needs to utilize the callback functions love.mousepressed() and love.mousereleased() to track whether a click happened since the last update.
pirogronian
Prole
Posts: 17
Joined: Sun Jun 30, 2019 5:38 pm

Re: Slab - An Immediate Mode GUI Library In Lua

Post by pirogronian »

ki wrote: Wed Aug 19, 2020 2:58 pm Here's a bug report regarding short mouse clicks. Slab doesn't register most of the clicks I do with my trackpad.

If a mouse click is very short, which means that the interval between "mouse button is pressed down" and "mouse button is released" is somewhere less than 16.66 ms (if Löve is running at 60 FPS), then Slab doesn't recognize the mouse click. This is easy to reproduce when using a trackpad, if the trackpad is configured to register a click when the user lightly taps the trackpad. When testing with macOS and an Apple trackpad, I get clicks that are only about 0,000005 seconds long, as measured by love.timer.getTime() with the callback functions love.mousepressed() and love.mousepressed().

Currently Slab only queries the state of the mouse buttons with love.mouse.isDown() on every update, and if the button was pressed and released between two updates, no click is registered. I think Slab needs to utilize the callback functions love.mousepressed() and love.mousereleased() to track whether a click happened since the last update.
You may check out my today workaround from my fork: https://github.com/pirogronian/Slab , branch MouseEvents. To not messing too much in original code, I introduced separate API:

Code: Select all

WasMousePressed(button, times)
WasMouseReleased(button, times)
WasControlPressed(button, times)
WasControlReleased(button, times)
"times" refers to number of events in "short time and space", according to LOVE wiki. 2 would be "double click" equivalent.

Of course, You must provide appropriate events to Slab, for example:

Code: Select all

function love.mousepressed(x, y, button, istouch, times)
    Slab.MousePressed(x, y, button, istouch, times)
end
coding.jackalope
Prole
Posts: 29
Joined: Sun Feb 24, 2019 6:30 pm

Re: Slab - An Immediate Mode GUI Library In Lua

Post by coding.jackalope »

ki wrote: Wed Aug 19, 2020 2:58 pm Thank you for this library, coding.jackalope!

Here's a bug report regarding short mouse clicks. Slab doesn't register most of the clicks I do with my trackpad.
Hi ki, good to hear this library is helpful to your project. I am adding this issue to be fixed for the upcoming patch release.
pirogronian wrote: Thu Aug 20, 2020 8:49 am You may check out my today workaround from my fork: https://github.com/pirogronian/Slab , branch MouseEvents. To not messing too much in original code, I introduced separate API:
Thanks for the suggestion pirogronian. Your solution is very similar to what I had planned for the fix and could get around needing developers to forward the mouse and keyboard calls to Slab.
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: Slab - An Immediate Mode GUI Library In Lua

Post by borr »

Сan you show an example of creation node graph with slab?
like this
https://github.com/thedmd/imgui-node-editor

thanks.
coding.jackalope
Prole
Posts: 29
Joined: Sun Feb 24, 2019 6:30 pm

Re: Slab - An Immediate Mode GUI Library In Lua

Post by coding.jackalope »

Slab v0.7.1

Slab.love
(224.36 KiB) Downloaded 755 times

Hello everyone. There is a new patch release for Slab. This release provides fixes that have been found since the last release. Some of these fixes required a refactor such as the input system, which now processes input events asynchronously through the Love defined events. Please visit the releases page linked above for more information on the changes made for this release.
borr wrote: Sun Oct 11, 2020 9:24 am Сan you show an example of creation node graph with slab?
like this
https://github.com/thedmd/imgui-node-editor

thanks.
Hi borr, I saw that you posted this question to the project Github and it has been answered there.
coding.jackalope
Prole
Posts: 29
Joined: Sun Feb 24, 2019 6:30 pm

Re: Slab - An Immediate Mode GUI Library In Lua

Post by coding.jackalope »

Slab v0.7.2

Slab.love
(225.18 KiB) Downloaded 742 times

Hello everyone. There is a new patch release for Slab. This release provides fixes that have been found since the last release. Some progress has been made for mobile support as a few fixes on those platforms are included. Please visit the releases page linked above for more information on the changes made for this release.
Josepho
Prole
Posts: 7
Joined: Thu Nov 19, 2020 4:21 pm
Contact:

Re: Slab - An Immediate Mode GUI Library In Lua

Post by Josepho »

Awesome work :)
Follow me on twitter @josepho
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Slab - An Immediate Mode GUI Library In Lua

Post by togFox »

I've been procrastinating about building a GUI for my latest project due to LOVE2D forcing 'controls' to be written from scratch but now that I've discovered this I think I'm good to go!!!

I looked through the GITHUB and saw options/radio buttons but I couldn't find a checkbox. Is that included? If I'm clever enough (and I'm probably not!) then I can perhaps suggest some coding for that maybe.

This is great stuff and sorely needed.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
coding.jackalope
Prole
Posts: 29
Joined: Sun Feb 24, 2019 6:30 pm

Re: Slab - An Immediate Mode GUI Library In Lua

Post by coding.jackalope »

Thanks for the kind words! Glad to hear this project is helping out with yours.

Slab does support check boxes. The documentation for them can be found here.
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Slab - An Immediate Mode GUI Library In Lua

Post by togFox »

This would have been crazy hard to do in vanilla Love2D so I'm TOTALLY loving what has happened here. :)

https://cdn.discordapp.com/attachments/ ... nknown.png

This is my gridiron roster with player attributes colour coded in table format. Very nice. And I'll have even more examples soon enough.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests