Game Development Reference
In-Depth Information
After you define your simple types like uint32, you define a Handle union to be used as a pointer transporter
between the calling application and the editor core internals. This will keep things simpler, since the user can't use the
pointer itself anyway (see Listing 11-1).
Listing 11-1. A Generic Handle Container
// A generic handle, used to pass pointers in command parameters without having
// to know the pointer type
union Handle
{
Handle()
: hVoidPtr(NULL)
{}
explicit Handle(int32 aVal)
: hInt(aVal)
{}
explicit Handle(int64 aVal)
: hInt64(aVal)
{}
explicit Handle(void* pVal)
: hVoidPtr(pVal)
{}
int32 hInt;
int64 hInt64;
void* hVoidPtr;
};
You will also need a Version structure to be used in the various version comparisons/validations you will have
for the editor API and plug-in versions (see Listing 11-2).
Listing11-2. A Generic Version Holder Structure
// A version structure, holding version information for plug-in or editor
struct Version
{
Version();
Version(uint32 aMajor, uint32 aMinor, uint32 aBuild);
bool operator <= (const Version& rOther) const;
bool operator >= (const Version& rOther) const;
Version& operator = (const char* pVerStr);
uint32 major, minor, build;
};
After this, a central point of the editor core API is the main editor interface (see Listing 11-3), which will provide
command, plug-in, and event methods to be used by plug-ins and their commands, and also by the main editor
skeleton application, which will manage those plug-ins.
 
Search WWH ::




Custom Search