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.
[Lib] SUIT - Simple User Interface Toolkit
Re: [Lib] SUIT - Simple User Interface Toolkit
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.
Re: [Lib] SUIT - Simple User Interface Toolkit
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?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.
- alberto_lara
- Party member
- Posts: 372
- Joined: Wed Oct 30, 2013 8:59 pm
Re: [Lib] SUIT - Simple User Interface Toolkit
Zarty55 wrote: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?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.
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()
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: [Lib] SUIT - Simple User Interface Toolkit
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 True 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.
- alberto_lara
- Party member
- Posts: 372
- Joined: Wed Oct 30, 2013 8:59 pm
Re: [Lib] SUIT - Simple User Interface Toolkit
Correct, that's why I said "rules", with quotes
-
- Party member
- Posts: 712
- Joined: Fri Jun 22, 2012 4:54 pm
- Contact:
Re: [Lib] SUIT - Simple User Interface Toolkit
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?
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
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Re: [Lib] SUIT - Simple User Interface Toolkit
yep, the run loop looks likeGermanunkol 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?
* 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.
Re: [Lib] SUIT - Simple User Interface Toolkit
I am looking for a simple UI library capable of doing scrolling lists. Would you recommend SUIT?
Re: [Lib] SUIT - Simple User Interface Toolkit
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.
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.
Who is online
Users browsing this forum: No registered users and 7 guests