Slab - An Immediate Mode GUI Library In Lua
-
- Prole
- Posts: 29
- Joined: Sun Feb 24, 2019 6:30 pm
Re: Slab - An Immediate Mode GUI Library In Lua
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
I did try it out and worked really well. Nice tutorial file, good wiki documentation and easy to follow
Thanks Jackalope, awesome work ^~^
Thanks Jackalope, awesome work ^~^
Re: Slab - An Immediate Mode GUI Library In Lua
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
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
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.
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.
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
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
Re: Slab - An Immediate Mode GUI Library In 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
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.
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.
-
- Prole
- Posts: 29
- Joined: Sun Feb 24, 2019 6:30 pm
Re: Slab - An Immediate Mode GUI Library In Lua
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.
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.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.
Re: Slab - An Immediate Mode GUI Library In Lua
Thanks for your answeer.
I got transparency working with :
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
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
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
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Slab - An Immediate Mode GUI Library In Lua
Hi @coding.jackalope, just wondering why there's no activity for a very long time at Slab's repo at Github?
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: Slab - An Immediate Mode GUI Library In Lua
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 and the canvas itself is drawn during
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 :
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
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
Code: Select all
love.draw
However, as soon as I add :
Code: Select all
Slab.Initialize(args)
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
Who is online
Users browsing this forum: Bing [Bot] and 5 guests