MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator / MainWindow

Function MainWindow

src/VulkanSample.cpp:2698–2757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2696}
2697
2698int MainWindow()
2699{
2700 WNDCLASSEX wndClassDesc = { sizeof(WNDCLASSEX) };
2701 wndClassDesc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
2702 wndClassDesc.hbrBackground = NULL;
2703 wndClassDesc.hCursor = LoadCursor(NULL, IDC_CROSS);
2704 wndClassDesc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
2705 wndClassDesc.hInstance = g_hAppInstance;
2706 wndClassDesc.lpfnWndProc = WndProc;
2707 wndClassDesc.lpszClassName = WINDOW_CLASS_NAME;
2708
2709 const ATOM hWndClass = RegisterClassEx(&wndClassDesc);
2710 assert(hWndClass);
2711
2712 const DWORD style = WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME;
2713 const DWORD exStyle = 0;
2714
2715 RECT rect = { 0, 0, g_SizeX, g_SizeY };
2716 AdjustWindowRectEx(&rect, style, FALSE, exStyle);
2717
2718 g_hWnd = CreateWindowEx(
2719 exStyle, WINDOW_CLASS_NAME, APP_TITLE_W, style,
2720 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
2721 NULL, NULL, g_hAppInstance, NULL);
2722 assert(g_hWnd);
2723
2724 InitializeApplication();
2725 //PrintAllocatorStats();
2726
2727 // Run tests and close program
2728 if(g_CommandLineParameters.m_Test)
2729 Test();
2730 if(g_CommandLineParameters.m_TestSparseBinding)
2731 {
2732 if(g_SparseBindingEnabled)
2733 TestSparseBinding();
2734 else
2735 printf("Sparse binding not supported.\n");
2736 }
2737 if(g_CommandLineParameters.m_Test || g_CommandLineParameters.m_TestSparseBinding)
2738 PostMessage(g_hWnd, WM_CLOSE, 0, 0);
2739
2740 MSG msg;
2741 for(;;)
2742 {
2743 if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
2744 {
2745 if(msg.message == WM_QUIT)
2746 break;
2747 TranslateMessage(&msg);
2748 DispatchMessage(&msg);
2749 }
2750 else if(IsWindowMinimizedOrZeroSized())
2751 Sleep(25);
2752 else
2753 DrawFrame();
2754 }
2755

Callers 1

Main2Function · 0.85

Calls 5

InitializeApplicationFunction · 0.85
TestFunction · 0.85
TestSparseBindingFunction · 0.85
DrawFrameFunction · 0.85

Tested by

no test coverage detected