Game Development Reference
In-Depth Information
Delete —This template function is designed as a convenience
function to delete an object on the free store and set the pointer to
null.
WndProc —The window procedure declaration for the main appli-
cation window
1.5.2 Sample Framework
By sample framework we are referring to the general way that we struc-
ture the sample applications of this topic. For each sample we consis-
tently implement three functions, not counting the message procedure
and WinMain . These three functions are used to implement the code
specific to the particular sample. They are:
bool Setup() —This function is where we set up anything that
needs to be set up for this sample, such as allocating resources,
checking device capabilities, and setting application states.
void Cleanup() —This function is where we free anything that
we allocated in the Setup function, such as deallocating memory.
bool Display(float timeDelta) —This function is where
we implement all of our drawing code and code that occurs on a
frame-by-frame basis, such as updating object positions. The
parameter timeDelta is the time elapsed between each frame and
is used to sync animations with the frames per second.
1.5.3 Sample: D3D Init
As stated, the sample application creates and initializes a Direct3D
application, and then clears the screen to black. Note that we make use
of our utility functions to simplify initialization. The complete project
can be found on this chapter's page on the topic's web site.
Note: This sample closely follows the ideas discussed in Tutorial 1 in
the DirectX SDK documentation. You may wish to read Tutorial 1 after
this chapter to gain a different perspective.
We start out by including d3dUtility.h and instantiating a global variable
for the device:
#include "d3dUtility.h"
IDirect3DDevice9* Device = 0;
Next we implement our framework functions:
bool Setup()
{
Team-Fly ®
Search WWH ::




Custom Search