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

Function WndProc

Apps/ValidationTests/Win32/App.cpp:237–285  ·  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

235//
236//
237LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
238{
239 switch (message)
240 {
241 case WM_SYSCOMMAND:
242 {
243 if ((wParam & 0xFFF0) == SC_MINIMIZE)
244 {
245 runtime->Suspend();
246 }
247 else if ((wParam & 0xFFF0) == SC_RESTORE)
248 {
249 runtime->Resume();
250 }
251 DefWindowProc(hWnd, message, wParam, lParam);
252 break;
253 }
254 case WM_PAINT:
255 {
256 PAINTSTRUCT ps;
257 BeginPaint(hWnd, &ps);
258 EndPaint(hWnd, &ps);
259 break;
260 }
261 case WM_SIZE:
262 {
263 if (runtime != nullptr) {
264 size_t width = static_cast<size_t>(LOWORD(lParam));
265 size_t height = static_cast<size_t>(HIWORD(lParam));
266 runtime->Dispatch([width, height](Napi::Env env) {
267 Babylon::Plugins::NativeWindow::UpdateSize(env, width, height);
268 });
269 }
270 break;
271 }
272 case WM_DESTROY:
273 {
274 short exitCode = LOWORD(wParam);
275 Uninitialize();
276 PostQuitMessage(exitCode);
277 break;
278 }
279 default:
280 {
281 return DefWindowProc(hWnd, message, wParam, lParam);
282 }
283 }
284 return 0;
285}

Callers

nothing calls this directly

Calls 5

UpdateSizeFunction · 0.85
UninitializeFunction · 0.70
SuspendMethod · 0.45
ResumeMethod · 0.45
DispatchMethod · 0.45

Tested by

no test coverage detected