Working with GUI controls is easy, if you have the right magic string containing the name of the control. This is easy and relatively effortless, but I think we can go even further in making this easy for developers!
When the GUI is exported, it should be relatively simple to walk the control tree and use it to generate a JS module containing constants for the control names and potentially even get accessors for them. The resulting code then can be used by the consuming app, helping to keep it DRY.
Perhaps this exhibits in the editor as an additional export option; in that case the JSON of the GUI could be combined with the JS module
2 Likes
@jelster
Can you please stop coming up with good ideas!
Kidding of course! Great feedback! I’ll chat through this with @msDestiny14 and see what we can come up with.
4 Likes
NO! But only because you asked so nicely
2 Likes
Thing through this some more, here are some refinements:
-
ES6 module format!
-
Module should expose an async
initialize
API that internally loads the GUI up and preps it for use
-
Exposing update
methods as observers - perhaps we generate Observer
functions that can subscribe to Observables
producing updated values for the control. If set
accessors are suited that would work better. Example: onScoreChangedObservable.add(guiModule.score.onUpdate)
-
(Optional) allow or provide pre-set AnimationGroups and/or Animations for actions like fade in/out, etc.
-
(Optional) expose control life cycle events like onResize as further sets of Observables
2 Likes