Game Development Reference
In-Depth Information
// Call into our Dll main function, which will set up an
// instance of the EditorApp project.
NativeMethods.EditorMain(
hInstance, IntPtr.Zero, hwnd, 1,
this.DisplayPanel.Width, this.DisplayPanel.Height);
InitializeAssetTree();
m_messageFilter = new MessageHandler(
this.Handle, this.DisplayPanel.Handle, this);
m_ActorComponentEditor = new ActorComponentEditor(
Panel_ActorComponents, m_ProjectDirectory);
}
catch(Exception e)
{
MessageBox.Show(
Error:
+ e.ToString());
}
}
}
The first lines initialize the m_ProjectsDirectory and m_AssetsDirectory
members, which are constructed assuming the editor application is running in the
directory where the game assets will eventually be saved. The member m_Current
LevelFile is set only after a level file has been loaded.
The call to InitializeComponent() is what C# Windows Forms use to create and
attach all the menus, panels, or other user interface objects. This function is gener-
ated code by Visual Studio anytime you add or remove these components within the
Forms Designer.
The call to GetHINSTANCE() grabs the instance handle for this application, and the
next line gets the window handle for the panel that will become the main rendering
area on the C# form. These handles are converted into integer values and then passed
into the EditorMain function in the unmanaged C++ DLL.
The next line calls InitializeAssetTree() , reads the project directory, and
populates a tree view with all the filenames. A tree view of every game asset is conve-
nient for anyone using the editor to easily browse and edit the files that can be used
to create the game.
The next two lines initialize some helper classes for the EditorForm. The first of
these initializes the MessageHandler object, which you read about in the previous
section. The next object, ActorComponentEditor , you
'
ll read about in the next
section.
Search WWH ::




Custom Search