[Lib] SUIT - Simple User Interface Toolkit

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by parallax7d » Mon Feb 22, 2016 1:51 pm

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.

Zarty55
Citizen
Posts: 79
Joined: Thu Jul 25, 2013 2:36 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by Zarty55 » Mon Feb 22, 2016 7:37 pm

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.

User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by parallax7d » Wed Mar 09, 2016 9:16 am

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

Zarty55
Citizen
Posts: 79
Joined: Thu Jul 25, 2013 2:36 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by Zarty55 » Wed Mar 09, 2016 3:31 pm

parallax7d wrote:
Zarty55 wrote:
You can layout your widgets with cells.

http://suit.readthedocs.org/en/latest/layout.html
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.

nyx
Prole
Posts: 8
Joined: Sun Apr 17, 2016 3:09 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by nyx » Sun Apr 17, 2016 3:12 am

Zarty55 wrote:
parallax7d wrote:
Zarty55 wrote:
You can layout your widgets with cells.

http://suit.readthedocs.org/en/latest/layout.html
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

Code: Select all

suit.layout:row()
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 :)

User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by vrld » Sun Apr 17, 2016 4:41 pm

You can use layout:push() and layout:pop() for nested layouts. The main example in the documentation shows how to use it.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

nyx
Prole
Posts: 8
Joined: Sun Apr 17, 2016 3:09 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by nyx » Sun Apr 17, 2016 5:06 pm

Ah yes of course, great library btw.

Is there a way to make an inner cell default to 100% of the container width?

User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by vrld » Sun Apr 17, 2016 5:07 pm

I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by murks » Sun Apr 17, 2016 5:37 pm

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  ]

User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by vrld » Sun Apr 17, 2016 7:02 pm

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
suit.png (814 Bytes) Viewed 1670 times
You are probably seeing this instead, right?
suit-bug.png
suit-bug.png (834 Bytes) Viewed 1670 times
Luckily, a fix has just been pushed... :roll:
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests