The confirmation of a transfer decision shows OK pressed while held
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
551d564efb
commit
23201fa637
3 files changed
+24
-4
No files matched your search
+9
-3
@@ -2551,12 +2551,18 @@ int main(int argc, char** argv) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return; }
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT))
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) {
|
||||
decision_screen.pointer_down(event.button.button == SDL_BUTTON_RIGHT);
|
||||
else if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT))
|
||||
// OK of the confirmation looks pressed while the mouse button is held
|
||||
if (event.button.button == SDL_BUTTON_LEFT && confirmation &&
|
||||
decision_screen.press(event.button.x, event.button.y))
|
||||
rendered_phase = UINT64_MAX;
|
||||
} else if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) {
|
||||
(void)decision_screen.pointer_up(event.button.x, event.button.y,
|
||||
event.button.button == SDL_BUTTON_RIGHT, elapsed);
|
||||
if (confirmation && !decision_screen.confirmation_dismissed()) rendered_phase = UINT64_MAX;
|
||||
}
|
||||
}
|
||||
if (confirmation ? decision_screen.confirmation_dismissed() : decision_screen.outcome_dismissed()) return;
|
||||
SDL_Delay(10);
|
||||
|
||||
@@ -601,6 +601,7 @@ std::optional<int> IncomingTransferScreen::pointer_up(int x, int y, bool right,
|
||||
// then the bid area (x 4..190, y from 0x8f, rows 0x11 pixels high). Empty slots, unsupported transactions
|
||||
// (except in the pending variant) and clicks after an answer are ignored.
|
||||
std::optional<int> IncomingTransferScreen::click(int x, int y, bool right, uint64_t elapsed_ms) {
|
||||
notice_pressed_ = false; // the release ends the pressed look
|
||||
if (confirmation_mode_) {
|
||||
if (!right && x >= 95 && x <= 220 && y >= 166 && y <= 176)
|
||||
confirmation_dismissed_ = true;
|
||||
@@ -676,7 +677,17 @@ void IncomingTransferScreen::draw_notice(Image& out) const {
|
||||
notice.body=state_.notice_text;
|
||||
notice.source_manager_flags=confirmation_mode_?0x80:0x40;
|
||||
draw_source_dialog(out,{widgets_,faces_,&badge_atlas_,body_,heading_,exe_,
|
||||
sprite_font_,texts_},notice,gradient_text_);
|
||||
sprite_font_,texts_},notice,gradient_text_,
|
||||
notice_pressed_ ? std::optional<GameEndTaxDialog::Button>(GameEndTaxDialog::Button::acknowledge) : std::nullopt);
|
||||
}
|
||||
|
||||
// Mouse DOWN on OK of a confirmation notice: drawn pressed until the release. Returns true when the picture changed.
|
||||
bool IncomingTransferScreen::press(int x, int y) {
|
||||
const bool on = confirmation_mode_ && !confirmation_dismissed_ &&
|
||||
source_dialog_button_at(TaxDialogKind::acknowledgement, false, x, y) == GameEndTaxDialog::Button::acknowledge;
|
||||
const bool changed = on != notice_pressed_;
|
||||
notice_pressed_ = on;
|
||||
return changed;
|
||||
}
|
||||
|
||||
} // namespace bmh::ui
|
||||
@@ -151,6 +151,8 @@ public:
|
||||
void pointer_down(bool right = false);
|
||||
std::optional<int> pointer_up(int x, int y, bool right = false, uint64_t elapsed_ms = 0);
|
||||
std::optional<int> click(int x, int y, bool right = false, uint64_t elapsed_ms = 0);
|
||||
// Mouse DOWN on OK of a confirmation: drawn pressed until the release (click()).
|
||||
bool press(int x, int y);
|
||||
std::optional<int> key(std::string_view name);
|
||||
bool dismiss_notice();
|
||||
bool notice_active() const { return !state_.notice_text.empty() && notice_active_; }
|
||||
@@ -174,6 +176,7 @@ private:
|
||||
uint8_t outcome_speed_setting_ = 0;
|
||||
bool outcome_dismissed_ = false;
|
||||
bool confirmation_mode_ = false, confirmation_dismissed_ = false;
|
||||
bool notice_pressed_ = false; // OK of the confirmation held down by the mouse
|
||||
std::optional<Image> confirmation_backdrop_;
|
||||
Image widgets_, faces_, badge_atlas_, seller_badge_atlas_;
|
||||
|
||||
|
||||
Reference in new issue
Block a user