[Lib] SUIT - Simple User Interface Toolkit

Showcase your libraries, tools and other projects that help your fellow love users.
nyx
Prole
Posts: 8
Joined: Sun Apr 17, 2016 3:09 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by nyx »

Hey, awesome! Sorry, all these answers are in the docs...

I am also wondering, how do you get SUIT to play nicely with love.graphics? I'm trying to draw images of my own and sometimes, calls to love.graphics.draw(image) or love.graphics.rectangle(etc, etc) or even love.printf() within SUIT do not actually draw the image.
nyx
Prole
Posts: 8
Joined: Sun Apr 17, 2016 3:09 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by nyx »

Just kidding, I figured it out. You have to call the love-related draw functions from within love.draw(). You can't call the draw functions from, say, love.update(). Probably need to learn love a little more, but hey.
Zarty55
Citizen
Posts: 79
Joined: Thu Jul 25, 2013 2:36 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by Zarty55 »

nyx wrote:Just kidding, I figured it out. You have to call the love-related draw functions from within love.draw(). You can't call the draw functions from, say, love.update(). Probably need to learn love a little more, but hey.
I want to talk about this. Has anyone found a way to do this without having to separate your code into love.update and love.draw? Or am I doing something wrong?
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by alberto_lara »

Zarty55 wrote:
nyx wrote:Just kidding, I figured it out. You have to call the love-related draw functions from within love.draw(). You can't call the draw functions from, say, love.update(). Probably need to learn love a little more, but hey.
I want to talk about this. Has anyone found a way to do this without having to separate your code into love.update and love.draw? Or am I doing something wrong?

As far as I know, "the rules" are these ones:

* You shall call drawing functions in love.draw() only

* You shall not try to draw things in love.update() or love.load(), this causes no errors but it has no effect

So, you can make calculations in love.draw() but, in order to have a more readable and modular code, you should draw in love.draw() and do the other stuff in love.update()
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by zorg »

Those "rules" exist because of how [wiki]love.run[/wiki] is defined. With a bit of modification and understanding one could modify that behaviour, though it's really not recommended, for many a reasons.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by alberto_lara »

Correct, that's why I said "rules", with quotes :)
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by Germanunkol »

Hi,
I'd like to use suit.anyHovered() in the love input callbacks (love.mousemoved, love.mousepressed ...), to check whether the input should go to what's beneath the GUI, or whether the GUI blocked the input.
However, in these functions, anyHovered is always false. I assume this is because love.update (where the suit layout is being generated) is called after the callbacks?

Is there a nice way to figure out if something howered over the GUI in the previous frame? (Of course, I could save suit.anyHovered into a global variable, but ugh.) Or do you recommend another way to do what I want?
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
alloyed
Citizen
Posts: 80
Joined: Thu May 28, 2015 8:45 pm
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by alloyed »

Germanunkol wrote:Hi,
I'd like to use suit.anyHovered() in the love input callbacks (love.mousemoved, love.mousepressed ...), to check whether the input should go to what's beneath the GUI, or whether the GUI blocked the input.
However, in these functions, anyHovered is always false. I assume this is because love.update (where the suit layout is being generated) is called after the callbacks?

Is there a nice way to figure out if something howered over the GUI in the previous frame? (Of course, I could save suit.anyHovered into a global variable, but ugh.) Or do you recommend another way to do what I want?
yep, the run loop looks like

* do events
* update (build suit state)
* draw (clear suit state)

so events happen in that void where the suit state is cleared. What I'm doing to work around this is by checking `suit.hovered_last` directly, which holds the hovered widget id as of the last frame, or nil if there's nothing being hovered over.
Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by Zireael »

I am looking for a simple UI library capable of doing scrolling lists. Would you recommend SUIT?
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by Rishavs »

If you dont want full sortable columns and otehr thingamajigs etc then its easy.

Create a msg_queue object.

start inserting all messages you want in the code in it.
create a var called wid_size where you define the number of messages to be shown.
(so if your msg_q obj has 1000 items and you only want to show the last 10 on each update)

then add two buttons and a slider in a horizontal layout (scrollbar)
when you click on the buttons or use the slider just keep changing the msgs range to be displayed.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 3 guests