Hey guys. I've searched around a bit before posting, but I wasn't sure what to look for, so forgive me if this has been answered.
What I'm looking to accomplish is the following:
Have a series of user-navigable menus drawn using the liquidCrystal library.
I've come up with some pseudo-code for what I want to do, but it's long enough that I'll just try and summarize what I have in mind.
I'd like to have:
- an int corresponding to which "menu" the user is in.
- an int corresponding to the selected "item" in that menu
- a bool corresponding to whether they are "editing" that item's "value"
- an array of names of "menu"s to be written to the screen for the user (id corresponds to the menu int.)
- an array of names of "items" in each menu (again the id's would match my "selected item" int)
- an array of values for each "item" in each "menu"
I'd ideally build in such a way that when I'm drawing the menu I can just use these variables plugged into the same function no matter what the menu structure looks like. This way, if I need to add items to the menu later it's no big deal -- I just adjust the lengths of the arrays and that's it.
So here are the questions I have:
- what's the best way to structure this? I'm thinking of a 2- or 3-dimensional array, but this starts to get complex when I try and think about how to link the values of items to their names. Another thought was to create a new class that handles all of this data stuff, but I don't know C well enough to know if that's a good approach.
- what's the best way to handle the large number of strings I'll be needing to keep track of? If it makes it any easier, I know they'll all be less than a certain length, and can pad them out to be all the same length with whitespace.
- The values of the menu items will be in a variety of formats, including some which are a list of text-based options that correspond to numeric values. (one example being the string "1/8000" which would represent the int 125)
- Is there a better way to be doing this? I don't have any *real* formal training in CS, so I'm sure there are better ways to do this.