mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Initial commit
This commit is contained in:
22
arm9/source/gui/input/SampledInputProvider.cpp
Normal file
22
arm9/source/gui/input/SampledInputProvider.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user