MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / createWindow

Method createWindow

examples/OpenGLWindow/Win32Window.cpp:554–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554void Win32Window::createWindow(const b3gWindowConstructionInfo& ci)
555{
556 int oglViewportWidth = ci.m_width;
557 int oglViewportHeight = ci.m_height;
558 bool fullscreen = ci.m_fullscreen;
559 int colorBitsPerPixel = ci.m_colorBitsPerPixel;
560 void* windowHandle = ci.m_windowHandle;
561
562 // get handle to exe file
563 HINSTANCE hInstance = GetModuleHandle(0);
564
565 // create the window if we need to and we do not use the null device
566 if (!windowHandle)
567 {
568#ifdef UNICODE
569 const wchar_t* ClassName = L"DeviceWin32";
570 const wchar_t* emptyString = L"";
571#else
572 const char* ClassName = "DeviceWin32";
573 const char* emptyString = "";
574#endif
575 // Register Class
576 WNDCLASSEX wcex;
577 wcex.cbSize = sizeof(WNDCLASSEX);
578 wcex.style = CS_HREDRAW | CS_VREDRAW;
579 wcex.lpfnWndProc = WndProc;
580 wcex.cbClsExtra = 0;
581 wcex.cbWndExtra = 0;
582 wcex.hInstance = hInstance;
583 wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION); //(HICON)LoadImage(hInstance, "bullet_ico.ico", IMAGE_ICON, 0,0, LR_LOADTRANSPARENT);//LR_LOADFROMFILE);
584 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
585 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
586 wcex.lpszMenuName = 0;
587 wcex.lpszClassName = ClassName;
588 wcex.hIconSm = 0;
589
590 // if there is an icon, load it
591 // wcex.hIcon = (HICON)LoadImage(hInstance, "bullet.ico", IMAGE_ICON, 0,0, LR_LOADFROMFILE);
592
593 RegisterClassEx(&wcex);
594
595 // calculate client size
596
597 RECT clientSize;
598 clientSize.top = 0;
599 clientSize.left = 0;
600 clientSize.right = oglViewportWidth;
601 clientSize.bottom = oglViewportHeight;
602
603 DWORD style = WS_POPUP;
604
605 if (!fullscreen)
606 style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX;
607
608 AdjustWindowRect(&clientSize, style, false);
609
610 m_data->m_fullWindowWidth = clientSize.right - clientSize.left;
611 m_data->m_fullWindowHeight = clientSize.bottom - clientSize.top;

Callers 5

mainFunction · 0.45
mainFunction · 0.45
SimpleOpenGL3AppMethod · 0.45
SimpleOpenGL2AppMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected