Page 3 of 9

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Mon Jan 18, 2016 4:40 pm
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.

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Mon Jan 18, 2016 4:50 pm
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

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Mon Jan 18, 2016 4:50 pm
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.

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Mon Jan 18, 2016 6:57 pm
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.

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Mon Jan 18, 2016 10:39 pm
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.

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Tue Jan 19, 2016 7:36 am
by vrld
Can you post a .love so I can have a look myself?

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Thu Jan 21, 2016 8:57 am
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

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Thu Jan 21, 2016 3:33 pm
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.

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Thu Jan 21, 2016 5:18 pm
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?

Re: [Lib] SUIT - Simple User Interface Toolkit

Posted: Fri Jan 22, 2016 8:48 am
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.