Update widgets

This commit is contained in:
IlyaShurupov 2024-05-07 12:04:36 +03:00
parent eb079e1386
commit d80dfd895d
18 changed files with 171 additions and 124 deletions

View file

@ -21,16 +21,16 @@ bool EventHandler::isEvents() {
InputState::State transitions[4][4] = {
{ InputState::State::NONE, InputState::State::PRESSED, InputState::State::PRESSED, InputState::State::NONE },
{ InputState::State::PRESSED, InputState::State::PRESSED, InputState::State::HOLD, InputState::State::PRESSED },
{ InputState::State::HOLD, InputState::State::RELEASED, InputState::State::RELEASED, InputState::State::HOLD },
{ InputState::State::RELEASED, InputState::State::NONE, InputState::State::NONE, InputState::State::RELEASED },
{ InputState::State::PRESSED, InputState::State::HOLD, InputState::State::HOLD, InputState::State::HOLD },
{ InputState::State::HOLD, InputState::State::HOLD, InputState::State::HOLD, InputState::State::RELEASED },
{ InputState::State::NONE, InputState::State::NONE, InputState::State::NONE, InputState::State::NONE },
};
bool transitionsReduce[4][4] = {
{ true, true, false, true },
{ true, true, false, true },
{ true, false, false, true },
{ true, false, true, true },
{ true, true, true, false },
{ true, true, true, false },
{ true, true, true, true },
};
void EventHandler::processEvent() {
@ -55,6 +55,8 @@ void EventHandler::processEvent() {
mInputStates[(int) inputId].mCurrentState = transitions[currentState][reportedEvent];
// printf("%i - %i \n", reportedEvent, mInputStates[(int) InputID::A].mCurrentState);
if (transitionsReduce[currentState][reportedEvent]) {
mEventQueue.popFront();
}