MCPcopy Create free account
hub / github.com/bo3b/3Dmigoto / DispatchInputEvents

Function DispatchInputEvents

DirectX9/Input.cpp:509–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509bool DispatchInputEvents(D3D9Wrapper::IDirect3DDevice9 *device)
510{
511 std::vector<class InputAction *>::iterator i;
512 class InputAction *action;
513 bool input_processed = false;
514 static time_t last_time = 0;
515 time_t now = time(NULL);
516 int j;
517
518 if (!CheckForegroundWindow())
519 return false;
520
521 for (j = 0; j < 4; j++) {
522 // Stagger polling controllers that were not connected last
523 // frame over four seconds to minimise performance impact,
524 // which has been observed to be extremely significant.
525 if (!XInputState[j].connected && ((now == last_time) || (now % 4 != j)))
526 continue;
527
528 XInputState[j].connected =
529 (_XInputGetState(j, &XInputState[j].state) == ERROR_SUCCESS);
530 }
531
532 last_time = now;
533
534 for (i = actions.begin(); i != actions.end(); i++) {
535 action = *i;
536
537 input_processed |= action->Dispatch(device);
538 }
539
540 return input_processed;
541}

Callers 7

DumpBufferMethod · 0.70
DumpResourceMethod · 0.70
_DumpCBsMethod · 0.70
DumpBufferMethod · 0.70
DumpResourceMethod · 0.70
RunFrameActionsFunction · 0.70

Calls 2

CheckForegroundWindowFunction · 0.70
DispatchMethod · 0.45

Tested by

no test coverage detected