bool CCEGLView::intializeGL( HDC dc ) { m_hDC = dc; m_bIsEditor = true; #if(_MSC_VER >= 1600) m_bSupportTouch = CheckTouchSupport(); if(m_bSupportTouch) { m_bSupportTouch = (s_pfRegisterTouchWindowFunction(m_hWnd, 0) != 0); } #endif /* #if(_MSC_VER >= 1600) */ return initGL(); }
bool CCEGLView::Create() { bool bRet = false; do { CC_BREAK_IF(m_hWnd); HINSTANCE hInstance = GetModuleHandle( NULL ); WNDCLASS wc; // Windows Class Structure // Redraw On Size, And Own DC For Window. wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = _WindowProc; // WndProc Handles Messages wc.cbClsExtra = 0; // No Extra Window Data wc.cbWndExtra = 0; // No Extra Window Data wc.hInstance = hInstance; // Set The Instance wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); // Load The Default Icon wc.hCursor = LoadCursor( NULL, IDC_ARROW ); // Load The Arrow Pointer wc.hbrBackground = NULL; // No Background Required For GL wc.lpszMenuName = m_menu; // wc.lpszClassName = kWindowClassName; // Set The Class Name CC_BREAK_IF(! RegisterClass(&wc) && 1410 != GetLastError()); // center window position RECT rcDesktop; GetWindowRect(GetDesktopWindow(), &rcDesktop); WCHAR wszBuf[50] = {0}; MultiByteToWideChar(CP_UTF8, 0, m_szViewName, -1, wszBuf, sizeof(wszBuf)); // create window m_hWnd = CreateWindowEx( WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, // Extended Style For The Window kWindowClassName, // Class Name wszBuf, // Window Title WS_CAPTION | WS_POPUPWINDOW | WS_MINIMIZEBOX, // Defined Window Style 0, 0, // Window Position //TODO: Initializing width with a large value to avoid getting a wrong client area by 'GetClientRect' function. 1000, // Window Width 1000, // Window Height NULL, // No Parent Window NULL, // No Menu hInstance, // Instance NULL ); CC_BREAK_IF(! m_hWnd); bRet = initGL(); if(!bRet) destroyGL(); CC_BREAK_IF(!bRet); s_pMainWindow = this; bRet = true; } while (0); #if(_MSC_VER >= 1600) m_bSupportTouch = CheckTouchSupport(); if(m_bSupportTouch) { m_bSupportTouch = (s_pfRegisterTouchWindowFunction(m_hWnd, 0) != 0); } #endif /* #if(_MSC_VER >= 1600) */ return bRet; }
bool CCEGLView::Create() { bool bRet = false; do { CC_BREAK_IF(m_hWnd); HINSTANCE hInstance = GetModuleHandle( NULL); WNDCLASS wc; // Windows Class Structure // Redraw On Size, And Own DC For Window. wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = _WindowProc; // WndProc Handles Messages wc.cbClsExtra = 0; // No Extra Window Data wc.cbWndExtra = 0; // No Extra Window Data wc.hInstance = hInstance; // Set The Instance wc.hIcon = LoadIcon( NULL, IDI_WINLOGO); // Load The Default Icon wc.hCursor = LoadCursor( NULL, IDC_ARROW); // Load The Arrow Pointer wc.hbrBackground = NULL; // No Background Required For GL wc.lpszMenuName = m_menu; // wc.lpszClassName = kWindowClassName; // Set The Class Name CC_BREAK_IF(! RegisterClass(&wc) && 1410 != GetLastError()); // center window position RECT rcDesktop; GetWindowRect(GetDesktopWindow(), &rcDesktop); WCHAR wszBuf[50] = { 0 }; MultiByteToWideChar(CP_UTF8, 0, m_szViewName, -1, wszBuf, sizeof(wszBuf)); // create window m_hWnd = CreateWindowEx( WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, // Extended Style For The Window kWindowClassName, // Class Name wszBuf, // Window Title WS_CAPTION | WS_POPUPWINDOW | WS_MINIMIZEBOX, // Defined Window Style 0, 0, // Window Position //TODO: Initializing width with a large value to avoid getting a wrong client area by 'GetClientRect' function. 1000,// Window Width 1000, // Window Height NULL, // No Parent Window NULL, // No Menu hInstance, // Instance NULL); // WNDCLASS wndclass = { 0 }; // DWORD wStyle = 0; // RECT windowRect; // HINSTANCE hInstance = GetModuleHandle(NULL); // // wndclass.style = CS_OWNDC; // wndclass.lpfnWndProc = (WNDPROC) _WindowProc;; // wndclass.hInstance = hInstance; // wndclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH); // wndclass.lpszClassName = TEXT("opengles2.0"); // // if (!RegisterClass(&wndclass)) // return FALSE; // // wStyle = WS_VISIBLE | WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION // | WS_SIZEBOX; // // // Adjust the window rectangle so that the client area has // // the correct number of pixels // windowRect.left = 0; // windowRect.top = 0; // windowRect.right = 400; // windowRect.bottom = 400; // // AdjustWindowRect(&windowRect, wStyle, FALSE); // // m_hWnd = CreateWindow( // TEXT("opengles2.0"), // TEXT("TEST!"), // wStyle, // 0, // 0, // windowRect.right - windowRect.left, // windowRect.bottom - windowRect.top, // NULL, // NULL, // hInstance, // NULL); CC_BREAK_IF(!m_hWnd); ShowWindow(m_hWnd, TRUE); m_glDevice = new CCGLDevice(m_hWnd); // printf("m_glDevice = %d\n", m_glDevice); if (!m_glDevice->isReady()) { printf("DEVICE NOT READY\n"); m_hWnd = NULL; return false; } s_pMainWindow = this; bRet = true; } while (0); #if(_MSC_VER >= 1600) m_bSupportTouch = CheckTouchSupport(); if(m_bSupportTouch) { m_bSupportTouch = (s_pfRegisterTouchWindowFunction(m_hWnd, 0) != 0); } #endif /* #if(_MSC_VER >= 1600) */ printf("RETURNING : %d", bRet); return bRet; }