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:
31
arm9/source/gui/input/InputRepeater.h
Normal file
31
arm9/source/gui/input/InputRepeater.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "InputProvider.h"
|
||||
|
||||
/// @brief Input provider that wraps another input provider and adds key repetition on top of it.
|
||||
class InputRepeater : public InputProvider
|
||||
{
|
||||
public:
|
||||
InputRepeater(InputProvider* inputProvider, InputKey repeatMask, u16 firstRepeatDelay, u16 nextRepeatDelay)
|
||||
: _inputProvider(inputProvider), _state(State::Idle)
|
||||
, _frameCounter(0), _repeatMask(repeatMask)
|
||||
, _firstRepeatDelayFrames(firstRepeatDelay)
|
||||
, _nextRepeatDelayFrames(nextRepeatDelay) { }
|
||||
|
||||
void Update() override;
|
||||
void Reset() override;
|
||||
|
||||
private:
|
||||
enum class State
|
||||
{
|
||||
Idle,
|
||||
FirstRepeat,
|
||||
NextRepeat
|
||||
};
|
||||
|
||||
InputProvider* _inputProvider;
|
||||
State _state;
|
||||
u16 _frameCounter;
|
||||
InputKey _repeatMask;
|
||||
u16 _firstRepeatDelayFrames;
|
||||
u16 _nextRepeatDelayFrames;
|
||||
};
|
||||
Reference in New Issue
Block a user