Game Development Reference
In-Depth Information
uint32 data1;
uint16 data2;
uint16 data3;
uint8 data4[8];
};
You will use the interface shown in Listing 11-7 to get information about the discovered plug-ins
(gathered from the plug-in manifest files).
Listing 11-7. The Interface that Describes a Plug-in (from the Plug-in Manifest)
struct IPluginInfo
{
virtual ~IPluginInfo(){}
virtual const char* GetName() const = 0;
virtual const char* GetDescription() const = 0;
virtual const char* GetAuthor() const = 0;
virtual const char* GetWebsiteUrl() const = 0;
virtual PluginGuid GetGuid() const = 0;
virtual Version GetVersion() const = 0;
virtual Version GetMinEditorVersion() const = 0;
virtual Version GetMaxEditorVersion() const = 0;
virtual const char* GetIconFilename() const = 0;
virtual bool IsUnloadable() const = 0;
virtual PluginGuidArray GetPluginDependencies()
const = 0;
};
The plug-in interface methods are easy to understand, but let's talk about GetMinEditorVersion() and
GetMaxEditorVersion() . These methods are used to check whether the plug-in can be loaded into the current editor
and help avoid loading plug-ins that are not supposed to run under newer or older editor versions.
The simple creation process of new plug-ins and commands should be the crux of this system, thus coding new
command sets hosted in the plug-ins should be straightforward. In the editor core API, there is an interface each plug-in
must implement on its side, called IPlugin , as shown in Listing 11-8.
Listing 11-8. The Interface to be Implemented by a Plug-in
struct IPlugin
{
virtual ~IPlugin(){}
virtual void Initialize(IEditor* pEditor) = 0;
virtual void Shutdown() = 0;
virtual bool IsCommandEnabled(TPfnCommand pCmdFunc)= 0;
};
Commands
You will create the editor core as a C++ DLL. This handles the loading of plug-ins that are exposing editing commands.
The GUI will call the commands using only the core editor interfaces (see Figure 11-2 ).
 
Search WWH ::




Custom Search