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
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
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.
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.
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.
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().
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.
suit.layout:reset(10,50)
mapButton = suit.ImageButton(buttonImg, {align = "left"}, suit.layout:row(32,32))
if mapButton.hit then mapDrawing = not mapDrawing end
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.