Page 5 of 9
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Mon Feb 22, 2016 1:51 pm
by parallax7d
WetDesertRock wrote:Uh, what about .push and .pop? I coerced slime to make that work for the graphics state. love.graphics.push("all")
Oh sweet, that's super useful. Had no idea it could do that. The little blurb on the wiki makes it seem like it's just for saving coordinates.
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Mon Feb 22, 2016 7:37 pm
by Zarty55
Hi. I'm using SUIT for the first time and it really fits love2d in how awesome it is and how good to use it is.
The only thing that it misses is some kind of frame that keeps child-objects inside it. I'm not sure if it's possible to do, but it would be really useful.
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Wed Mar 09, 2016 9:16 am
by parallax7d
Zarty55 wrote:Hi. I'm using SUIT for the first time and it really fits love2d in how awesome it is and how good to use it is.
The only thing that it misses is some kind of frame that keeps child-objects inside it. I'm not sure if it's possible to do, but it would be really useful.
You can layout your widgets with cells.
http://suit.readthedocs.org/en/latest/layout.html
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Wed Mar 09, 2016 3:31 pm
by Zarty55
After using it for a little bit I figured it out. But now I'm struggling with making rows/collumns. Because when I do a row() it changes the X of the next col(). Currently I'm doing some not ideal ways to work around this. But I'm really liking this library. It feels so good to use it.
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Sun Apr 17, 2016 3:12 am
by nyx
Zarty55 wrote:
After using it for a little bit I figured it out. But now I'm struggling with making rows/collumns. Because when I do a row() it changes the X of the next col(). Currently I'm doing some not ideal ways to work around this. But I'm really liking this library. It feels so good to use it.
I'm having the same issue.
right now, making
sets the new row's origin at the lower right corner of the existing cell.
it should set the origin at the lower LEFT corner.
also, if you do not load a font in LOVE, SUIT will crash.
I might just fix this in the source code myself and make a pr
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Sun Apr 17, 2016 4:41 pm
by vrld
You can use
layout:push() and layout:pop() for nested layouts. The
main example in the documentation shows how to use it.
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Sun Apr 17, 2016 5:06 pm
by nyx
Ah yes of course, great library btw.
Is there a way to make an inner cell default to 100% of the container width?
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Sun Apr 17, 2016 5:07 pm
by vrld
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Sun Apr 17, 2016 5:37 pm
by murks
I just had the same issue and probably did the same stupid workaround (reset the layout to reset the cell x, then guess the correct y position).
The main example code is not exactly the code that generate the animated example and I am also not sure that it shows how to handle this issue sanely.
What I tried to get was a simple:
Code: Select all
[ label ]
[ btn1 ][ btn2 ]
[ btn3 ]
What I could get without a nasty hack was:
Code: Select all
[ label ]
[ btn1 ][ btn2 ]
[ btn3 ]
Re: [Lib] SUIT - Simple User Interface Toolkit
Posted: Sun Apr 17, 2016 7:02 pm
by vrld
So, this code:
Code: Select all
local suit = require 'suit'
function love.update(dt)
suit.layout:reset(100,100, 10,10)
suit.Button("btn", suit.layout:row(200,30))
suit.layout:push(suit.layout:row())
suit.Button("btn1", suit.layout:col(95,30)) -- (200 - padding) / 2
suit.Button("btn2", suit.layout:col())
suit.layout:pop()
suit.Button("btn3", suit.layout:row(200))
end
function love.draw()
suit.draw()
end
Should produce this image:
- suit.png (814 Bytes) Viewed 12943 times
You are probably seeing this instead, right?
- suit-bug.png (834 Bytes) Viewed 12943 times
Luckily, a fix has just been pushed...