Plug(in)s

Introduction

Plugs (Plugins) are .NET Assemblies of a specific format which Planar can import in runtime to perform (complex) tasks ontop of the usual. You may which to do this simply to speed up a specific component, or to add special functionality without tempering with the source code. Remember to give Plugs clear, unamibuous (maybe even personalised) names to avoid conflict with other Plugs (note that you can probably have more than one Plug in one assembly, this is untested, but we can't see any reason why it shouldn't work).

Format

In Planar, a Plug in is known by an 'Alias', which is vitally assembly namespace and class names. I plug must have a static class within a namespace (both of the same name). Inside the static class, a static 'init(object)' function must exist, as must an 'exec(string)' function. When a plug is loaded with a named load function named alias plug filename ('alias' is the alias, filename the local assembelly container filename (DLL or EXE) the init function is called, and is passed a reference to the Planar 'MainForm', which hosues EVERYTHING you need to do anything with the program. Obviously to use this materially easily you'll need to have you plug include Planar.exe, which is fine (keeping dlls/exes in the same dir as 'Planar.exe' makes life easy).

Funcionality

The most significant piece of functionality in a plug (which MUST be implemented, even if unused) is the ability for the 'exec' method to called, via an exec command with plug alias arguments, passing arguments (which can contain spaces) as the string argument.

Other than this, a number of delegates are readily available allowing a plug to take control at specific points of a program (ie. at the start of every frame). Below is a list of avialable delegates (show in method syntax):

Remember that there are also standard Windows Forms events used (such as keyUp, keyDown), but note that when the developers finally decide to implement GLUT Properly, these may be ditched. It is important to note also that utilizing these delegates won't have your call before the standard functions, we did not deem this a vital matter such as in other cases where state preservation was important.