I probably should have made this thread a lot earlier, but better late than never!
As I'm working on Calcular Automation and my Rubik's Cube simulator, I'm finding that I want to create a GUI. Especially the cellular automation program will require some (relatively) advanced GUI stuff, beyond just buttons and basic menus. I'll need sliders (for configuring colors), weird checkbox-based things, number selectors, and text input. I have a vague idea of how to do some of these things; for example, I've looked at how Cacluzap and Pacman handle text input and it seems they use a LUT of sorts for the keypresses. But I was wondering what the best way to go about a GUI would be.
The obvious solution (which I would rather avoid) is hard-coding the various instruments for every single screen where they are used. Although this would be easy, it would be painfully copy-paste-based, take up a LOT of space on-calc, and would be next to impossible to modify the behavior of any one GUI control.
I've also considered setting up a modular system in which there's a certain delegated section of memory for GUI controls, each control gets a certain amount of data to store what it needs, and then there's some number somewhere that keeps track of the currently active control. Each control has it's own rendering routine, given an X and Y position, its allotted memory, and possibly a width and height. Whenever a key is pressed, it is redirected to a routine for that GUI control to manage (assuming the GUI control cares). These keys would probably just include [2nd], [Enter], and the arrow keys (which would usually move to the next control). This would also take a fair bit of memory to set up, but creating a new GUI "window" would be as simple as typing up some data to LDIR into the GUI memory and redraw.
So... what do you think is the best solution? Am I overthinking this? Is there a better way? I know most modern OSes use a modular system, but many things may have to change for a calculator. Should I aim for somewhere in between the two systems I've proposed, and if so how? Thank you all for the help!
As I'm working on Calcular Automation and my Rubik's Cube simulator, I'm finding that I want to create a GUI. Especially the cellular automation program will require some (relatively) advanced GUI stuff, beyond just buttons and basic menus. I'll need sliders (for configuring colors), weird checkbox-based things, number selectors, and text input. I have a vague idea of how to do some of these things; for example, I've looked at how Cacluzap and Pacman handle text input and it seems they use a LUT of sorts for the keypresses. But I was wondering what the best way to go about a GUI would be.
The obvious solution (which I would rather avoid) is hard-coding the various instruments for every single screen where they are used. Although this would be easy, it would be painfully copy-paste-based, take up a LOT of space on-calc, and would be next to impossible to modify the behavior of any one GUI control.
I've also considered setting up a modular system in which there's a certain delegated section of memory for GUI controls, each control gets a certain amount of data to store what it needs, and then there's some number somewhere that keeps track of the currently active control. Each control has it's own rendering routine, given an X and Y position, its allotted memory, and possibly a width and height. Whenever a key is pressed, it is redirected to a routine for that GUI control to manage (assuming the GUI control cares). These keys would probably just include [2nd], [Enter], and the arrow keys (which would usually move to the next control). This would also take a fair bit of memory to set up, but creating a new GUI "window" would be as simple as typing up some data to LDIR into the GUI memory and redraw.
So... what do you think is the best solution? Am I overthinking this? Is there a better way? I know most modern OSes use a modular system, but many things may have to change for a calculator. Should I aim for somewhere in between the two systems I've proposed, and if so how? Thank you all for the help!