Files
pico-launcher/arm9/source/gui/input/SampledInputProvider.cpp
2025-11-25 17:41:31 +01:00

23 lines
601 B
C++

#include "common.h"
#include "SampledInputProvider.h"
void SampledInputProvider::Update()
{
InputKey curKeys = _currentKeys;
InputKey trig = InputKey::None;
InputKey rel = InputKey::None;
while (_inputBufferReadPtr != _inputBufferWritePtr)
{
InputKey nextKeys = _inputBuffer[_inputBufferReadPtr];
trig |= (nextKeys ^ curKeys) & nextKeys;
rel |= (nextKeys ^ curKeys) & curKeys;
curKeys = nextKeys;
_inputBufferReadPtr = (_inputBufferReadPtr + 1) & 3;
}
_triggeredKeys = trig;
_releasedKeys = rel;
_currentKeys = curKeys;
}