Game Development Reference
In-Depth Information
'
Similar to the main loop in C++, when the editor application isn
t processing mes-
sages, it is idle and can do other jobs like render the 3D world.
public void Application_Idle(object sender, EventArgs e)
{
try
{
// Render the scene if we are idle
NativeMethods.RenderFrame();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
m_parent.Invalidate();
}
}
Application_Idle() calls into NativeMethods.RenderFrame() . This function
is called when the application is idle. At the end of the Application_Idle() ,
m_parent.Invalidate() invalidates the entire surface of the editor, so it will be
redrawn and display any changes to actor lists or actor components.
The C# Editor User Interface
You
ve been looking at a lot of code that wraps a C++ game engine with a C# Win-
dows Form application. As interesting as that might have been, all of this work is just
setting up the basics of a very extendable and data-driven editor.
'
Go Learn C# Windows Forms!
If you haven
t done any programming in C# or especially Windows Forms, the
following sections are going to be fairly confusing. They assume you know
how to create a Windows Form and add methods to handle events, such as
when control data changes or when a control has been clicked on, and much
more.
'
The EditorForm Class
The EditorForm class holds all of the controls of the game editor. It handles the
following tasks:
 
 
 
Search WWH ::




Custom Search