Wednesday, April 2, 2014

Driving windowing with data

I've decided to utilize XML to manage a lot of the data in the project.  XML is a great format that's been around for ages.  It's got some nice advantages to it, one being that it's fairly easily readable by an actual human being.  This is a big plus in two areas, one being it can speed up development considerably which is important when I'm trying to prototype out ideas.  Additionally it means that most of the data will be exposed in a very friendly manner which means modding will definitely be possible from a very early state, although it may be frustrating at first, as tools and code mature the process will become smoother (I promise!).

I've decided to use the open source project called RapidXML for my xml reading and writing needs.  It's a very proven product and used on several projects that are deployed in the real world.  Utilizing this code has allowed me to start pushing data into xml very rapidly (^_^)!

Yesterday I showed off a bit of the windowing.  Today I will be showing you how I am now utilizing the XML data to drive the system.





In-Engine Windowing
main_menu.xml
Here we have an in-engine scene of windowing driven by the XML in the next image.  Notice how there is more than one window visible.  This is because you are actually creating an entire scene, not just one window at a time.  The system can contain any number of windows and those windows can contain any number of widgets on them (as much as you have room to display anyway).  You probably see a button on the menu window titled "Make Window" and if you're perceptive you've noticed the corresponding line which has created the button in the XML.  If you're really perceptive you'll see a property of the button is called "template".  Now lets look at what happens when we click on that button:

In-Engine Windowing


info_panel.xml
Here we've spawned a new window which was created from the data available in, you guessed it, the file directed by the template property "info_panel.xml".  Notice how the newly spawned window has another enabled property you didn't see earlier.  This property is called "hasClose".  When set to true it allows the window to spawn with the ability to close itself.  It's important that this be toggleable because it will allow the creation of modal windows.

That's all I'm prepared to show off for today, now it's time to get back to work!


1 comment:

  1. Looking good! Def love xml and xhtml for web and data. Rapidxml is a pretty good parser. And fairly easy to debug ... most the time. lol

    ReplyDelete