No accidental confirmation
This commit is contained in:
@@ -11,6 +11,7 @@ ConfirmationActivity::ConfirmationActivity(GfxRenderer& renderer, MappedInputMan
|
||||
|
||||
void ConfirmationActivity::onEnter() {
|
||||
Activity::onEnter();
|
||||
inputArmed = false;
|
||||
|
||||
lineHeight = renderer.getLineHeight(fontId);
|
||||
const int maxWidth = renderer.getScreenWidth() - (margin * 2);
|
||||
@@ -56,6 +57,19 @@ void ConfirmationActivity::render(RenderLock&& lock) {
|
||||
}
|
||||
|
||||
void ConfirmationActivity::loop() {
|
||||
if (!inputArmed) {
|
||||
const bool anyFrontPressed = mappedInput.isPressed(MappedInputManager::Button::Back) ||
|
||||
mappedInput.isPressed(MappedInputManager::Button::Confirm) ||
|
||||
mappedInput.isPressed(MappedInputManager::Button::Left) ||
|
||||
mappedInput.isPressed(MappedInputManager::Button::Right);
|
||||
|
||||
// Ignore inherited press/release events from the parent activity.
|
||||
if (!anyFrontPressed && !mappedInput.wasAnyPressed() && !mappedInput.wasAnyReleased()) {
|
||||
inputArmed = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Right)) {
|
||||
ActivityResult res;
|
||||
res.isCancelled = false;
|
||||
|
||||
@@ -19,6 +19,7 @@ class ConfirmationActivity : public Activity {
|
||||
std::string safeBody;
|
||||
int startY = 0;
|
||||
int lineHeight = 0;
|
||||
bool inputArmed = false;
|
||||
|
||||
public:
|
||||
ConfirmationActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& heading,
|
||||
|
||||
Reference in New Issue
Block a user