robbielyman / seamstress

seamstress is an art engine
GNU General Public License v3.0
129 stars 12 forks source link

FIX: add params menu UI flags to 'binary' params:set #80

Closed dndrks closed 1 year ago

dndrks commented 1 year ago

hihi! hope all's well :)

this PR adds UI flags to the params:set() action for binary-style parameters.

test script:

function init()
  params:add_binary("toggle", "toggle")
  params:set_action("toggle", function(x)
    print("toggle is " .. tostring(x == 1))
  end)
  params:add_binary("trigger", "trigger", "trigger")
  params:set_action("trigger", function()
    print("trigger is triggered")
  end)
  params:add_binary("momentary", "momentary", "momentary")
  params:set_action("momentary", function(x)
    print("momentary is " .. tostring(x == 1))
  end)
end

and execute (for example) params:set('toggle', 1) or params:set('trigger', 1) on the command line. in the current build, this does not redraw the expected square in the params menu UI. with this PR, the expected square state is drawn.

lmk if there's anything i missed / if there are any q's!

dndrks commented 1 year ago

hmm, found an edge case, brb

dndrks commented 1 year ago

ok, we're back :) sorry about that! forgot that paramsMenu.triggered and paramsMenu.on need to get built when the library is first included