Esempio n. 1
0
bool GameApp::InitInstance(HINSTANCE hInstance, LPWSTR lpCmdLine, HWND hWnd, int screenWidth, int screenHeight)
{
	SetCursor( NULL );

	m_hInstance = hInstance;

	m_pOptions = GCC_NEW GameOptions("m_pOptions->ini");
	ParseCommandLine(lpCmdLine);

	m_pEventManager = GCC_NEW EventManager("CometConquest Event Mgr", true );
	if (!m_pEventManager)
	{
		return false;
	}

	RegisterBaseGameEvents();

	DXUTInit( true, true, NULL );

	if(hWnd==NULL)
	{
		DXUTCreateWindow( VGetGameTitle(), hInstance, VGetIcon() );
	}
	else
	{
		DXUTSetWindow( hWnd, hWnd, hWnd);
	}

	if(!GetHwnd())
	{
		return false;
	}
	SetWindowText(GetHwnd(), VGetGameTitle());

	DXUTCreateDevice (D3D_FEATURE_LEVEL_9_2, true, 800, 600 );

	m_pGame = VCreateGameAndView();
	if (!m_pGame)
		return false;

	m_bIsRunning = true;

	return true;

}
Esempio n. 2
0
void CDirect3DView::OnInitialUpdate()
{
    __super::OnInitialUpdate();

    if (DXUTGetD3D11Device() != NULL)
    {
        return;
    }

    DXUTSetIsInGammaCorrectMode(false);

    // Set general DXUT callbacks
    DXUTSetCallbackFrameMove( OnDXUTFrameMove, this );
    DXUTSetCallbackKeyboard( OnDXUTKeyboard, this );
    DXUTSetCallbackMouse( OnDXUTMouse, true, this );
    DXUTSetCallbackMsgProc( DXUTMsgProc, this );
    DXUTSetCallbackDeviceChanging( DXUTModifyDeviceSettings, this );
    DXUTSetCallbackDeviceRemoved( OnDXUTDeviceRemoved, this );

    // Set the D3D11 DXUT callbacks. Remove these sets if the app doesn't need to support D3D11
    DXUTSetCallbackD3D11DeviceAcceptable( DXUTIsD3D11DeviceAcceptable, this );
    DXUTSetCallbackD3D11DeviceCreated( OnDXUTD3D11CreateDevice, this );
    DXUTSetCallbackD3D11SwapChainResized( OnDXUTD3D11ResizedSwapChain, this );
    DXUTSetCallbackD3D11FrameRender( OnDXUTD3D11FrameRender, this );
    DXUTSetCallbackD3D11SwapChainReleasing( OnDXUTD3D11ReleasingSwapChain, this );
    DXUTSetCallbackD3D11DeviceDestroyed( OnDXUTD3D11DestroyDevice, this );

    DXUTInit( true, true, NULL ); // Parse the command line, show msgboxes on error, no extra command line params
    DXUTSetCursorSettings( true, true ); // Show the cursor and clip it when in full screen

    // Create DXUT stuff
    DXUTSetWindow( this->GetSafeHwnd(), this->GetSafeHwnd(), this->GetSafeHwnd(), false );
    CRect rect;

    GetClientRect(&rect);

    // Only require 10-level hardware
    DXUTCreateDevice( D3D_FEATURE_LEVEL_10_1, true, rect.right, rect.bottom );
}
void RenderWin32DX9Imp::setHWND( HWND hWnd ) {
    DXUTSetWindow( hWnd, hWnd, hWnd, false );
}