I noticed that there was a driver for the Incredible Brain Buggy aka bcheetah, so why not make a keypad for that as well:
What's kind of interesting is that the drive motor starts up for a moment then shuts off before it does a command. In programming mode, you press buttons simultaneously, like fwd + 2 to go forward for 1 second, left + 4 for left turn for 2 seconds.
Switching to run mode makes the forward, left and right buttons immediate.
So I thought it'd be interesting to be able to do a repeat inside of an element tag so you could do something like the following, and it took me quite a while to figure out how that all worked:
The way it's structured is that you can do a repeat outside of an element tag, but not a repeat inside of an element. Inside of an element, it only expects to see layout components like image, rect, text, etc.
Since the processing for the element happens inside the constructor layout_element::layout_element, I made another routine to handle the repeat so when it sees this repeat tag it calls this repeat routine and handles the components inside (mainly just a copy of the regular constructor code, but processing the param tags).
Then I just use the environment expand routine on the get_data of the svg, and it will do the parameter expansion.
The hardest part was getting it to work was in the little details, since set_repeat_parameter takes a boolean and effectively doesn't do anything if that boolean is false. So on the first pass of the repeat this boolean should be true and then false for the succeeding passes since the increment routine does all the updating.