[Lib] SUIT - Simple User Interface Toolkit

Showcase your libraries, tools and other projects that help your fellow love users.
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 »

I think it is note even related to the mouse:

Code: Select all

	local bstart = menu:Button("Start", {font=FONT.big}, menu.layout:row(bw, bh))
	print(bstart)
	print('mouse is active on button', suit.isActive(bstart))
	print(INSPECT(bstart))
	if bstart.hit then
		print('menu start clicked')
		GS.switch(STATE.GAME)
	end
produces:

Code: Select all

table: 0x41d456a0
mouse is active on button	false
{
  entered = false,
  hit = true,
  hovered = true,
  id = "Start",
  left = false
}
menu start clicked
I am stumped.
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 »

Sorry for all those updates. I just noticed that it does work if instead of this:

Code: Select all

function st:init()
	suit = require 'lib/SUIT'
	menu = suit.new()
end

function st:enter(_)
end
I do this:

Code: Select all

function st:init()
	suit = require 'lib/SUIT'
end

function st:enter(_)
	menu = suit.new() -- works, but should not be necessary according to https://suit.readthedocs.org/en/latest/core.html#instancing
end
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 »

Cool, just a hint for textfields, you could add a "timer" delay for repeating a key when pressing a while, I used delta time for this in GOOi (https://github.com/tavuntu/gooi) but maybe os.time() would be a better approach for this.
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 »

murks wrote:[Quadruple post]
I think the issue is that the UI state is reset in suit.draw(), but hump.gamestate always calls update() before draw. That is, the UI state will not be reset when you enter the menu state again. This is bad design on SUIT's part and will be fixed soon-ish.

In the meantime, you can reset the UI state manually by calling suit.enterFrame() in the state update function.
alberto_lara wrote:Cool, just a hint for textfields, you could add a "timer" delay for repeating a key when pressing a while, I used delta time for this in GOOi (https://github.com/tavuntu/gooi) but maybe os.time() would be a better approach for this.
You could, and should use [wiki]love.keyboard.setKeyRepeat[/wiki] for that.
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 »

I have during tested created an instance called 'menu'. Neiter calling 'suit.enterFrame()' nor 'menu:enterFrame()' at the beginning of 'function st:update(dt)' solves the issue.
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 »

Can you post a .love so I can have a look myself?
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 »

Hi vrld.
Sorry it took me a while.
Here is the current state of my framing. I removed and disabled some assets for reasons of size and rights (no attributions yet). It still works just the same, just doesn't do much (intro video & resource loading -> menu <-> game).

This is without the 'enterFrame() change you suggested because I could not make it work.
Instead, suit.new() is called on enter().
framework_state_debug.love
(726.13 KiB) Downloaded 224 times
Frohman
Prole
Posts: 21
Joined: Sat Dec 08, 2012 12:32 pm

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by Frohman »

What's the intended way to change the color of a widget, say, to indicate an incorrect state or disabled status?

e: Aha, got it. You've got to specify the color, whether it is fore or background and the state it represents. For example;

Code: Select all

{font = textFont, color = {normal = {bg = {255,0,0}, fg = {225,225,225}}}
Passed to a button makes its unpressed, unhovered state bright red with white text.
lookaway
Prole
Posts: 1
Joined: Thu Jan 21, 2016 5:09 pm

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by lookaway »

Hello,

SUIT works great for me if I'm testing on Windows with a mouse, but i'm developing for iOS. When I export to my iPhone and try to tap my ImageButton it doesn't trigger.hovered or .hit.

Nothing fancy:

Code: Select all

suit.layout:reset(10,50)
mapButton = suit.ImageButton(buttonImg, {align = "left"}, suit.layout:row(32,32))
if mapButton.hit then mapDrawing = not mapDrawing end
thoughts?
pevzi
Prole
Posts: 27
Joined: Tue Apr 02, 2013 4:09 pm
Contact:

Re: [Lib] SUIT - Simple User Interface Toolkit

Post by pevzi »

A really nice and clean library.
I think it would be useful if the field which is to be used by a widget to store its value was selectable instead of hardcoded to "text" or "value". It could be used to make quick debugging GUIs to adjust objects' properties in runtime.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests