Game Development Reference
In-Depth Information
HINSTANCE hInstance = (HINSTANCE)instancePtrAddress;
HINSTANCE hPrevInstance = (HINSTANCE) hPrevInstancePtrAddress;
HWND hWnd = (HWND)hWndPtrAddress;
WCHAR *lpCmdLine = L
“”
;
// Note
you can and should put your _CrtSetDebugFlag() calls right here
// to track any memory corruptions or leaks...
-
Logger::Init(
logging.xml
);
g_pApp->m_Options.Init(
EditorOptions.xml
, lpCmdLine);
DXUTSetCallbackMsgProc( GameCodeApp::MsgProc );
DXUTSetCallbackFrameMove( GameCodeApp::OnUpdateGame );
DXUTSetCallbackDeviceChanging( GameCodeApp::ModifyDeviceSettings );
DXUTSetCallbackD3D11DeviceAcceptable(GameCodeApp::IsD3D11DeviceAcceptable);
DXUTSetCallbackD3D11DeviceCreated( GameCodeApp::OnD3D11CreateDevice );
DXUTSetCallbackD3D11SwapChainResized(GameCodeApp::OnD3D11ResizedSwapChain);
DXUTSetCallbackD3D11SwapChainReleasing(
GameCodeApp::OnD3D11ReleasingSwapChain );
DXUTSetCallbackD3D11DeviceDestroyed( GameCodeApp::OnD3D11DestroyDevice );
DXUTSetCallbackD3D11FrameRender( GameCodeApp::OnD3D11FrameRender );
// Show the cursor and clip it when in full screen
DXUTSetCursorSettings( true, true );
// Perform application initialization
if (!g_pApp->InitInstance (hInstance, lpCmdLine, hWnd,
screenWidth, screenHeight))
return FALSE;
// This is where the game would normally call the main loop, but the
// C# application will control this, so we don
'
t need to call
// DXUTMainLoop() here.
return true;
}
The first few lines of EditorMain() cast some integer pointers into Windows han-
dles for the application instance and window. C# pointers are very different beasts
because the Common Language Runtime (CLR) uses managed memory. The C#
application will pass the correct values into this function as integers.
At the very end of the function, instead of starting the main loop with DXUTMain-
Loop() , the function simply exits. The C# editor will handle its own main loop, call-
ing the DXUT functions
to render and update
the game.
If you called
Search WWH ::




Custom Search