Just found this extension, seems it’s really good for making UI. But I have a little question about showing/hiding buttons.
I have the following code (show some buttons if button_toggle_turret1 is clicked and hide buttons if user clicks anywhere):
function on_input(self, action_id, action)
dirtylarry:button("button_toggle_turret1", action_id, action, function ()
local enabled = not gui.is_enabled(gui.get_node("Turret1"))
gui.set_enabled(gui.get_node("Turret1"), enabled)
end)
if gui.is_enabled(gui.get_node("Turret1")) == true and action_id == hash("LMB") then
gui.set_enabled(gui.get_node("Turret1"), disabled)
end
end
It works just fine but just in editor’s build. In HTML5 I have the following problem: it executes showing and hiding of buttons just at the same time. When user clicks button to show some buttons - you already clicked, so buttons are hidden instantly. How to fix that?
Here how it looks like in Defold editor (unfortunately cursor has not been recorded)
In HTML5 build, as I said, no buttons will appear if one clicks.