|
||
Primer for MFC Applications |
||||||||||||
Up and Running
For MFC applications, it is a relatively simple task to get up and running with the SilverScreen engine. The following describes a pretty simple-minded application.
Here is what needs be done to integrate SilverEngine:
Note that it is usually not necessary to explicitly add the SilverEngine export library to your link command. The SILVER.H file contains Visual C++ pragmas that cause the compiler to add the appropriate link commands implicitly.
|
||||||||||||
CWinApp Modifications
In the implementation file (.CPP) for your CWinApp-derived class, find the InitInstance method. The following code should be placed at the top:
At the bottom, once the main frame window has been created, place the following code:
Now find the ExitInstance method. Place the following code before the return statement:
|
||||||||||||
CView Modifications The CView-derived class is where a lot of the action happens. In its header file, find the Implementation section, and add a bit of code:
Now go to the implementation (.CPP) file. In the constructor for your CView-derived class, add the following initializations:
These member variables must also be cleaned up on destruction. Therefore, in the CView destructor, add the following code:
SilverEngine assumes that device contexts used to render into are persistent, i.e. private to the application window class. In order to ensure this, you would usually create the window using the CS_OWNDC class flag. So you should now create a PreCreateWindow method for the CView class, and place the following code before the return statement:
Most likely the best place to manage application/SilverEngine connections is in the CView::OnSize method. This is where we discover the initial size of the SilverEngine window, and the place we need to handle resizing of the refresh bitmap. So create one, and add the following code:
|
||||||||||||
See Also |
See the SilverEngine sample EngineShell for a complete example |
|||||||||||