I think I want to prioritize making my code simple to use. The idea is that you define a Unit.screen
object for every collection of panel-like objects, and the parent-child relationships between UI elements can be represented naturally, using nested tables. So, to the user, every panel (screens and buttons are specialized panels) has two tables: a table of attributes, such as color, button function, etc, and a table of children. And then each child has their own table of attributes and children.
I definitely want to beef up the default values, but I also want to make inheritance between parents and children modular. Right now, inheritance is only in place for size— i.e., the size of the child panel depends on the size of the parent panel. I’m not sure whether children should, by default, inherit all of their undefined attributes, or if they should only inherit ‘basic’ values like colors. A fully modular inheritance system would make this less of an issue, but to make the system as easy to use as possible, I also need to know what functionality is the most intuitive. Sometimes that is difficult to see. For panel size, it was relatively straightforward— all panels’ sizes are defined as percentages of their parent panels, by default. But what does this mean for color or shape or even functionality? I’m thinking that maybe color and shape should be inherited (when they aren’t explicitly defined) instead of getting top-level default values, but if I make too many inheritance rules, it can seem arbitrary.
Right now, I’ll focus on documentation and immediate ease-of-use. I’m slowly updating the wiki on Github, though I’m not sure that is the most effective documentation. I’ve also thought about including a tutorial (or at least some kind of onboarding) within the Unit project, though I’m not sure how to go about that. The lazy way is to print a long string in Unit.setup()
, and that could suffice if there is sufficiently accessible information in other places.
An easy first step for me would probably be making it possible to write myScreen = Unit.screen()
in the setup function without failing an assertion. I can see that as an easy first step in a tutorial for Unit. Then I could probably make Unit’s version of a “Hello World” program, which could add a text panel in the middle of the screen.
Right now, I consider Unit to be in an ‘alpha’ state, meaning that it is early in development and much of its API is still subject to change. Eventually, the API should stabilize, and once I have a nice, stable codebase with all the core features, I’ll work more on features. It’s an interesting journey, and I’m excited to see where it goes.