MCPcopy Create free account
hub / github.com/Wassimulator/CactusViewer / init_all

Function init_all

src/source.cpp:659–838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659static void init_all() {
660 DLOG_INIT("init_all START");
661 WW = 700;
662 WH = 800;
663
664 HINSTANCE hInstance = GetModuleHandle(NULL);
665 const char* szTitle = "CactusViewer";
666
667 DLOG_INIT("Registering window class");
668 WNDCLASSEX wcex;
669 wcex.cbSize = sizeof(WNDCLASSEX);
670 wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
671 wcex.lpfnWndProc = WndProc;
672 wcex.cbClsExtra = 0;
673 wcex.cbWndExtra = 0;
674 wcex.hInstance = hInstance;
675 wcex.hbrBackground = NULL;
676 wcex.lpszMenuName = nullptr;
677 wcex.lpszClassName = L"CactusViewer" ;
678 wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(1));
679 wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(1));
680 wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
681 RegisterClassEx(&wcex);
682 RECT rc { 0, 0, WW, WH };
683 AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, 0);
684 hwnd = CreateWindowEx(WS_EX_APPWINDOW, L"CactusViewer", L"CactusViewer", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, hInstance, nullptr);
685 hdc = GetDC(hwnd);
686 center_window();
687 PIXELFORMATDESCRIPTOR pfd;
688 ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
689 pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
690 pfd.nVersion = 1;
691 pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
692 pfd.iPixelType = PFD_TYPE_RGBA;
693 pfd.cColorBits = 32;
694 pfd.cDepthBits = 24;
695 pfd.cStencilBits = 8;
696
697 SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
698
699 DLOG_INIT("Starting GDI+");
700 Gdiplus::GdiplusStartupInput gdipsi;
701 ULONG_PTR gdipt;
702 Gdiplus::GdiplusStartup(&gdipt, &gdipsi, NULL);
703
704 DLOG_INIT("Initializing D3D11");
705 init_d3d11(hwnd, WW, WH);
706 DLOG_INIT("Initializing logo image");
707 init_logo_image();
708
709 bg_color[0] = 0.15;
710 bg_color[1] = 0.15;
711 bg_color[2] = 0.15;
712 bg_color[3] = 0;
713 float c1 = 0.16;
714 float c2 = 0.1;
715 checkerboard_color_1[0] = c1;
716 checkerboard_color_1[1] = c1;

Callers 1

wmainFunction · 0.85

Calls 11

center_windowFunction · 0.85
init_d3d11Function · 0.85
init_logo_imageFunction · 0.85
create_textureFunction · 0.85
load_settingsFunction · 0.85
UI_init_contextFunction · 0.85
UI_d3d11_initFunction · 0.85
UI_init_platform_win32Function · 0.85
UI_load_font_fileFunction · 0.85
set_to_no_fileFunction · 0.85

Tested by

no test coverage detected