int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); // //init Directx if (!initDirect3D()) return false; return 0; }
bool D3DApp::init(void) { if (!initMainWindow()) return false; if (!initDirect3D()) return false; initInputDevice(); return true; }
CGameWindow::CGameWindow( HINSTANCE hInstance, std::string windowCaption ) { m_hInstance = hInstance; m_strWindowCaption = windowCaption; m_bPaused = false; initGameWindow(); initDirect3D(); }
D3DApp::D3DApp(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP) { mMainWndCaption = winCaption; mDevType = devType; mRequestedVP = requestedVP; mhAppInst = hInstance; mhMainWnd = 0; md3dObject = 0; mAppPaused = false; ZeroMemory(&md3dPP, sizeof(md3dPP)); initMainWindow(); initDirect3D(); }
void D3DApp::initApp(){ initMainWindow(); initDirect3D(); D3DX10_FONT_DESC fontDesc; fontDesc.Height = 12; fontDesc.Width = 0; fontDesc.Weight = 0; fontDesc.MipLevels = 1; fontDesc.Italic = false; fontDesc.CharSet = DEFAULT_CHARSET; fontDesc.OutputPrecision = OUT_DEFAULT_PRECIS; fontDesc.Quality = DEFAULT_QUALITY; fontDesc.PitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; wcscpy(fontDesc.FaceName, L"Times New Roman"); D3DX10CreateFontIndirect(md3dDevice, &fontDesc, &mFont); }
/********************************************************************* * WinMain *********************************************************************/ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // call our function to init direct3D if (!initDirect3D()) { MessageBox(NULL, _T("Unable to init Direct3D"), _T("ERROR"), MB_OK); return false; } DialogBox(hInstance, MAKEINTRESOURCE(IDD_MODES), NULL, DialogProc); // release the device and the direct3D object if( pD3D != NULL) pD3D->Release(); return 0; }
LPDIRECT3DDEVICE D3DeviceFactory::createDevice(HWND hwnd, D3DPRESENT_PARAMETERS *param, UINT adapter) { // static if(s_direct3D == NULL) { initDirect3D(); } D3DPRESENT_PARAMETERS tmpParam; if(param == NULL) { tmpParam = getDefaultPresentParameters(hwnd, adapter); param = &tmpParam; } LPDIRECT3DDEVICE device; CHECKRESULT(s_direct3D->CreateDeviceEx(adapter ,D3DDEVTYPE_HAL ,hwnd ,D3DCREATE_SOFTWARE_VERTEXPROCESSING ,param ,NULL ,&device)); TRACE_CREATE(device); return device; }
void Window::initApp() { initMainWindow(); initDirect3D(); }