The UI now can get its data from game code! This is big! This is huge! While this feature is limited right now, I can easily expand on it in the future to add support for other features. I was worried for a bit there on if this is even possible, but now with that out of the way, I can easily create new screens and windows a LOT faster than before. No more worrying about handling mouse events inside a screen (lots of duplicate code there). I just specify XML files and the game handles the rest!
Here's a screenshot of the galaxy setup screen that I'm working on. The drop-down on top right contains the list of available scripts that the game code found in the scripts folder. This is not hard-coded at all! It's all loaded from a XML file! The "Cluster Galaxy" text that you see is actually a screen inside another screen, so you can create unique UI (dropdown that contains pictures and text for example).
I plan on expanding this more! There's two more features that I need to add to the new UI system to finish the Galaxy Setup screen:
Ability to retrieve list of star systems and display them using sprites referred inside the star system class
Ability to load UI from inside a script file (galaxy scripts allows users to specify certain parameters, such as number of arms)
Once those's done, I will chuck out the old galaxy setup.cs file! The first feature will be the hardest, but if done, will give modders powerful ability to specify how stars are drawn. For example, draw a name above a star, or below it? Or even on the side? Fleet icons? Extra fluff UI to make it look nice? Draw small planet icons around the star to show its planets? Etc...