MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / WndProc

Function WndProc

cube/cube.cpp:4016–4062  ·  view source on GitHub ↗

MS-Windows event handling function:

Source from the content-addressed store, hash-verified

4014
4015// MS-Windows event handling function:
4016LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
4017 switch (uMsg) {
4018 case WM_CLOSE:
4019 PostQuitMessage(validation_error);
4020 break;
4021 case WM_PAINT:
4022 if (!demo.in_callback) {
4023 demo.run<WsiPlatform::win32>();
4024 }
4025 break;
4026 case WM_GETMINMAXINFO: // set window's minimum size
4027 ((MINMAXINFO *)lParam)->ptMinTrackSize = demo.minsize;
4028 return 0;
4029 case WM_ERASEBKGND:
4030 return 1;
4031 case WM_SIZE:
4032 // Resize the application to the new window size, except when
4033 // it was minimized. Vulkan doesn't support images or swapchains
4034 // with width=0 and height=0.
4035 if (wParam != SIZE_MINIMIZED) {
4036 demo.width = lParam & 0xffff;
4037 demo.height = (lParam & 0xffff0000) >> 16;
4038 demo.resize();
4039 }
4040 break;
4041 case WM_KEYDOWN:
4042 switch (wParam) {
4043 case VK_ESCAPE:
4044 PostQuitMessage(validation_error);
4045 break;
4046 case VK_LEFT:
4047 demo.spin_angle -= demo.spin_increment;
4048 break;
4049 case VK_RIGHT:
4050 demo.spin_angle += demo.spin_increment;
4051 break;
4052 case VK_SPACE:
4053 demo.pause = !demo.pause;
4054 break;
4055 }
4056 return 0;
4057 default:
4058 break;
4059 }
4060
4061 return (DefWindowProc(hWnd, uMsg, wParam, lParam));
4062}
4063
4064int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow) {
4065 // TODO: Gah.. refactor. This isn't 1989.

Callers

nothing calls this directly

Calls 1

resizeMethod · 0.80

Tested by

no test coverage detected