hank wrote:Clive,
Is your CELX UI code packaged for general use?
- Hank
Yes and no. I tried to create fairly generic routines, but the Guide was a big project and some things just had to be tailored for its use. I am assuming that by "packaged" you mean a set of functions that can be copy/pasted into a script and used without any additional functions or setup..
If you look at the code, you can see that I have divided the functions into sections with the functions appearing alphabetically in each section. The sections are bordered by comments full of "vvvvvvvvvv" characters at the top and "^^^^^^^^^^' characters at the bottom.
They are listed as:
Celestia Cleanup Function
This one should really be renamed to "Settings Functions" and include
restore_settings() and
save_settings() to be considered a packaged set. I'll do that for the next update.
Keyboard Related Functions and Variables
This one could be considered a package.
Generic Utility Functions
I'd have to double check this section, but I believe the functions in this section are self-contained (packaged). Again,
restore_settings() and
save_settings() really belong with the
celestia_cleanup_callback() function.
In this section, the function with the most potential for re-use is the
show_and_hold() function. This has proved very useful while debugging scripts.
Miscellaneous Functions Used Througout The Script
This also appears to be a pretty good package, with the exception of
string_common(). Though it could be considered portable, it's use is pretty esoteric, and I can't imagine anyone getting much use out of it.
One the other hand, I am quite proud of the
travel_to() function in this section. It is, by far, the most complex and syntactically difficult of all the functions in the Guide. It arose because I noticed that there is a flaw in all of Celestia's "goto" functions that causes an error in the ending position of the observer unless the time rate is 0 (time is frozen). The error is slight, but shows up dramatically when one moves over light-years while the time rate changes the simulation time over a period of millenia. Anyway - to get around it (and to challenge myself) I decided to try building my own. I learned a lot about frames and rotations while writing
travel_to(). It could definetly be considered a package onto itself.
Menu Related Functions and Variables
These could be adapted foruse by other scripts (and in fact I plan to do so), but as they are currently written, I think they depend too much on the overall structure and function of the Guide.
The remaining sections are definitely Guide-specific.
I tried to document the functions with leading comments as well.
If you are interested in the how any of them work, or have problems or questions about getting them to work in your scripts, just drop me a line. I'd be glad to help.