MCPcopy Create free account
hub / github.com/diasurgical/devilution / PeekMessageA

Function PeekMessageA

SourceX/miniwin/misc_msg.cpp:345–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345bool PeekMessageA(LPMSG lpMsg)
346{
347#ifdef __SWITCH__
348 HandleDocking();
349#endif
350
351 if (!message_queue.empty()) {
352 *lpMsg = message_queue.front();
353 message_queue.pop_front();
354 return true;
355 }
356
357 SDL_Event e;
358 if (!SDL_PollEvent(&e)) {
359 return false;
360 }
361
362 lpMsg->message = 0;
363 lpMsg->lParam = 0;
364 lpMsg->wParam = 0;
365
366 if (e.type == SDL_QUIT) {
367 lpMsg->message = DVL_WM_QUIT;
368 return true;
369 }
370
371#ifndef USE_SDL1
372 handle_touch(&e, MouseX, MouseY);
373#endif
374
375#ifdef USE_SDL1
376 if (e.type == SDL_MOUSEMOTION) {
377 OutputToLogical(&e.motion.x, &e.motion.y);
378 } else if (e.type == SDL_MOUSEBUTTONDOWN || e.type == SDL_MOUSEBUTTONUP) {
379 OutputToLogical(&e.button.x, &e.button.y);
380 }
381#endif
382
383 if ((e.type == SDL_KEYUP || e.type == SDL_KEYDOWN) && e.key.keysym.sym == SDLK_UNKNOWN) {
384 // Erroneous events generated by RG350 kernel.
385 return true;
386 }
387
388 if (ProcessControllerMotion(e)) {
389 ScaleJoysticks();
390 return true;
391 }
392
393 GameAction action;
394 if (GetGameAction(e, &action)) {
395 if (action.type != GameActionType::NONE) {
396 sgbControllerActive = true;
397
398 if (movie_playing) {
399 lpMsg->message = DVL_WM_KEYDOWN;
400 if (action.type == GameActionType::SEND_KEY)
401 lpMsg->wParam = action.send_key.vk_code;
402 return true;

Callers

nothing calls this directly

Calls 15

HandleDockingFunction · 0.85
handle_touchFunction · 0.85
OutputToLogicalFunction · 0.85
ProcessControllerMotionFunction · 0.85
ScaleJoysticksFunction · 0.85
GetGameActionFunction · 0.85
UseBeltItemFunction · 0.85
PerformPrimaryActionFunction · 0.85
PerformSecondaryActionFunction · 0.85
PerformSpellActionFunction · 0.85
BlurInventoryFunction · 0.85
DoSpeedBookFunction · 0.85

Tested by

no test coverage detected