Page 7 of 10

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Thu Mar 18, 2021 3:16 pm
by coding.jackalope
Thanks for sharing a screenshot of your project using Slab. Its always great seeing Slab used by other developers.

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Wed May 12, 2021 5:44 pm
by pericles
I did try it out and worked really well. Nice tutorial file, good wiki documentation and easy to follow :3

Thanks Jackalope, awesome work ^~^

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Thu Jun 03, 2021 9:33 pm
by deb75
Hello,

Is it possible to make the gui semi-transparent ?

I retrieved Slab from github, but it is unclear for me how to install it. In my project directory, I have ./lib/ext directory where I put all
external libraires. What should I put in there from Slab ? There is "Slab.lua", but also "init.lua" ? Do I have to put "main.lua" which seems to be an example file ?

regards

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Thu Jun 03, 2021 11:05 pm
by togFox
Put the whole slab folder in a subdirectory under main.lua.

In main.lua you use

Slab = require 'Slab.Slab

Slab.Slab refers to the slab.lua file in the slab subfolder.

Maybe you can set the alpha value when setting slab colours to get transparency.

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Fri Jun 04, 2021 7:48 am
by grump
deb75 wrote: Thu Jun 03, 2021 9:33 pm There is "Slab.lua", but also "init.lua" ?
When you have a lib in a folder, and it has a file named init.lua, you require the folder. In your case

Code: Select all

local Slab = require('lib.ext.Slab')

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Fri Jun 04, 2021 9:22 am
by deb75
Thanks for your answeers.

By the way, what is the best practice with external libraries.

I used to putting them within the root project directory. However, I noticed that love2d also searches in /path/to/lovedir/ (for dlls) and /path/to/lovedir/lua/ for lua files.

On the one hand, it seems better to put external libraries in a project independent location but on the other hand, if I want to distribute the game as a *.love file, I will have to embed them.

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Fri Jun 04, 2021 4:08 pm
by coding.jackalope
deb75 wrote: Thu Jun 03, 2021 9:33 pm Hello,

Is it possible to make the gui semi-transparent ?

regards
Hi deb75, you can make the gui semi-transparent in a few ways. One way is to modify the 'BgColor' option when calling the 'BeginWindow' function. Another option is to modify the 'WindowBackgroundColor' style setting in 'Styles.lua'. You can find more information about this here.
deb75 wrote: Fri Jun 04, 2021 9:22 am Thanks for your answeers.

By the way, what is the best practice with external libraries.

I used to putting them within the root project directory. However, I noticed that love2d also searches in /path/to/lovedir/ (for dlls) and /path/to/lovedir/lua/ for lua files.

On the one hand, it seems better to put external libraries in a project independent location but on the other hand, if I want to distribute the game as a *.love file, I will have to embed them.
I think this is more personal preference. I like to place dependencies as sub-folders under the root project under some 'ext' folder. This makes it easy for distribution, and you can quickly move this over to another platform and test without having to re-download dependencies again.

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Fri Jun 04, 2021 9:13 pm
by deb75
Thanks for your answeer.

I got transparency working with :

Code: Select all

local Slab = require("lib.ext.Slab")

function love.load(args)
    love.graphics.setBackgroundColor(0.4, 0.88, 1.0)
    Slab.Initialize(args)
end

function love.update(dt)
    Slab.Update(dt)

    Slab.BeginWindow("MyFirstWindow", {
        BgColor = { 0.5, 0.5, 0.5, 0.5 },
        Rounding = 5,
    })
    Slab.Text("Hello World")
   
    Slab.EndWindow()
end

function love.draw()
    Slab.Draw()
end

However, when I move the window, some shadow windows appear at some place, if I put the window into one of the shadow one,
the window gets stuck to one of the border. Can I suppress this behavior ?

Also, is it possible to round not all corner of the box ? say only two diagonally opposed of them ?

Regards

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Wed Jun 09, 2021 3:01 am
by yetneverdone
Hi @coding.jackalope, just wondering why there's no activity for a very long time at Slab's repo at Github?

Re: Slab - An Immediate Mode GUI Library In Lua

Posted: Fri Jul 23, 2021 8:04 am
by deb75
Hello,

I experience some difficulties with Slab.

I develop a game which has a background composed of tiled images which can change when moving the mouse, just like when you use openstreet map. Tiled images are drawn on a canvas during the

Code: Select all

love.update
and the canvas itself is drawn during

Code: Select all

love.draw
It runs smoothly, that is to say I can drag the background with the mouse like on google map.

However, as soon as I add :

Code: Select all

Slab.Initialize(args)
I can no more drag the background smoothly. More precisely, the background is no more drawn when moving the mouse.
However, when I release the mouse button, it does draw again the background as expected.

Do you have any idea for why Slab has this effect on the drawing ? So sad that it prevents me from using Slab.

Regards