excessive / DOMy

A DOM-like GUI framework for the *awesome* LÖVE framework
Other
32 stars 2 forks source link

Event Markup #6

Closed karai17 closed 9 years ago

karai17 commented 9 years ago

As discussed in Issue #4, should events such as on_click, on_hover, etc be able to be defined within the markup of the file, or should events be strictly defined in scripts?

{ "button" on_click=function() do_a_thing() end, "Button Text" }

or

-- markup.lua
{ "button", id="Button1", "Button Text" }

-- scripts.lua
local button = dom.get_button_by_id("Button1")
button.on_click = do_a_thing
karai17 commented 9 years ago

After some consideration, I believe that it is probably best to have events defined in scripts. It will make things much easier to deal with for both the library and the user. I will update the markup file accordingly.