Monday, February 10, 2014

FMod - XML Config and Event Bus

I have come to the point in Fudge development where all that remains to do is add advanced features that will set it apart from existing editors. One such feature is the extension API that I've had around forever. Today, I more fully implemented the XML configuration that I talked about in the previous post. I added a ConfigHelper static class that allows directory-like navigation of those document trees, optimized for the standard Fudge way of storing stuff. Those trees are then saved inside the .fudge file or in persist.fconf for general settings.

Another major extension API feature added today is the event bus. Methods that subscribe to such events are flagged with a <FudgeEventBus> attribute. When the GUI performs an extensible action, it uses reflection on all loaded extension objects to find a method with a matching type signature and that attribute. It will then be automatically called, adding its entries to a passed-in list.

I took advantage of the new config mechanism to hold values for an automatic platform pather. The standard tools "extension" uses the XML initializer event bus to set the defaults, which are used by the actual tool later. So far, it can path horizontal and vertical lines, but I need to make it understand non-perfectly-straight changes.

No comments:

Post a Comment