No accidental confirmation
This commit is contained in:
@@ -11,6 +11,7 @@ ConfirmationActivity::ConfirmationActivity(GfxRenderer& renderer, MappedInputMan
|
|||||||
|
|
||||||
void ConfirmationActivity::onEnter() {
|
void ConfirmationActivity::onEnter() {
|
||||||
Activity::onEnter();
|
Activity::onEnter();
|
||||||
|
inputArmed = false;
|
||||||
|
|
||||||
lineHeight = renderer.getLineHeight(fontId);
|
lineHeight = renderer.getLineHeight(fontId);
|
||||||
const int maxWidth = renderer.getScreenWidth() - (margin * 2);
|
const int maxWidth = renderer.getScreenWidth() - (margin * 2);
|
||||||
@@ -56,6 +57,19 @@ void ConfirmationActivity::render(RenderLock&& lock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmationActivity::loop() {
|
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)) {
|
if (mappedInput.wasReleased(MappedInputManager::Button::Right)) {
|
||||||
ActivityResult res;
|
ActivityResult res;
|
||||||
res.isCancelled = false;
|
res.isCancelled = false;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class ConfirmationActivity : public Activity {
|
|||||||
std::string safeBody;
|
std::string safeBody;
|
||||||
int startY = 0;
|
int startY = 0;
|
||||||
int lineHeight = 0;
|
int lineHeight = 0;
|
||||||
|
bool inputArmed = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConfirmationActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& heading,
|
ConfirmationActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& heading,
|
||||||
|
|||||||
Reference in New Issue
Block a user