MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / WndProc

Function WndProc

Apps/Playground/Win32/App.cpp:269–366  ·  view source on GitHub ↗

FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) PURPOSE: Processes messages for the main window. WM_COMMAND - process the application menu WM_PAINT - Paint the main window WM_DESTROY - post a quit message and return

Source from the content-addressed store, hash-verified

267//
268//
269LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
270{
271 switch (message)
272 {
273 case WM_SYSCOMMAND:
274 {
275 if ((wParam & 0xFFF0) == SC_MINIMIZE)
276 {
277 runtime->Suspend();
278 }
279 else if ((wParam & 0xFFF0) == SC_RESTORE)
280 {
281 runtime->Resume();
282 }
283 DefWindowProc(hWnd, message, wParam, lParam);
284 break;
285 }
286 case WM_COMMAND:
287 {
288 int wmId = LOWORD(wParam);
289 // Parse the menu selections:
290 switch (wmId)
291 {
292 case IDM_ABOUT:
293 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
294 break;
295 case IDM_EXIT:
296 DestroyWindow(hWnd);
297 break;
298 default:
299 return DefWindowProc(hWnd, message, wParam, lParam);
300 }
301 break;
302 }
303 case WM_PAINT:
304 {
305 PAINTSTRUCT ps;
306 BeginPaint(hWnd, &ps);
307 EndPaint(hWnd, &ps);
308 break;
309 }
310 case WM_SIZE:
311 {
312 if (runtime != nullptr)
313 {
314 auto width = static_cast<size_t>(LOWORD(lParam));
315 auto height = static_cast<size_t>(HIWORD(lParam));
316 UpdateWindowSize(width, height);
317 }
318 break;
319 }
320 case WM_DESTROY:
321 {
322 Uninitialize();
323 PostQuitMessage(0);
324 break;
325 }
326 case WM_KEYDOWN:

Callers

nothing calls this directly

Calls 7

RefreshBabylonFunction · 0.85
SetPointerPositionMethod · 0.80
SetPointerDownMethod · 0.80
UpdateWindowSizeFunction · 0.70
UninitializeFunction · 0.70
SuspendMethod · 0.45
ResumeMethod · 0.45

Tested by

no test coverage detected