Minus and plus of the start menu show the original pressed picture

The buttons of the game setup (and of the joining manager's setup) use the darker
picture from the bottom of the setup atlas while the mouse button is held, as in a
recording of the real game; the release redraws even when the value is at its limit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-11-08 20:09:07 +01:00
1 parent 09fcd8383f
commit e65bd27375
5 files changed
+59 -2

No files matched your search

+4
View File
@@ -27,6 +27,10 @@ already did). Now pressed while held:
button and OK; **file dialog:** Ja/Nein of the overwrite question and the page
button of a long list; **manager confirmation:** JA and NEIN; **transfer
decision:** OK of the confirmation.
- **Start menu (game setup):** the minus and plus buttons show the original's
darker pressed picture while the mouse button is held (also in the joining
manager's setup). It is a different picture, not a shifted copy of the button,
and was taken from a recording of the real game.
- The notices that wait for any click (Sportschau, cup draw, game end screens) have
no button and are unchanged. Toggles that stay on (training, filters) keep their
lasting state.
+3
View File
@@ -1096,6 +1096,9 @@ bool StartupFlow::press_hold(int x,int y) {
if (bank_) return bank_->press(x, y);
if (outgoing_transfer_) return outgoing_transfer_->press(x, y);
if (manager_ && !desktop_) return manager_->press(x, y);
// the setup screen at the start of a game, and its joining variant
if (joining_) return !manager_ && !join_options_pending_ && !join_choice_pending_ && join_setup_ && join_setup_->press(x, y);
if (screen_name() == "setup") return setup_.press(x, y);
return false;
}
+35 -2
View File
@@ -84,7 +84,36 @@ SetupScreen::SetupScreen(const std::filesystem::path& data, SetupOptions current
difficulty_arrows_locked_ = current.difficulty == 0;
}
// The button (0..3 minus, 4..7 plus of duration, difficulty, managers, mode) under the pointer that can be used, or -1.
int SetupScreen::button_at(int x, int y) const {
for (int b = 0; b < 8; ++b) {
if (joining_ && (!joining_arrow_permission_[b] ||
(difficulty_arrows_locked_ && (b == 1 || b == 5))))
continue;
if (x >= button_x_[b] && x <= button_x_[b] + 0x33 && y >= button_y_[b] && y <= button_y_[b] + 0x28) return b;
}
return -1;
}
// Mouse DOWN on a minus or plus button: it is drawn pressed until the release (click()). Returns true when the
// picture changed.
bool SetupScreen::press(int x, int y) {
const int id = x < 0 || y < 0 || x >= 320 || y >= 240 ? -1 : button_at(x, y);
const bool changed = id != pressed_button_;
pressed_button_ = id;
return changed;
}
SetupResult SetupScreen::click(int x, int y, bool right) {
// the release ends the pressed look, which needs a redraw even when the value stays (a button at its limit)
const bool was_pressed = pressed_button_ >= 0;
pressed_button_ = -1;
SetupResult result = handle_click(x, y, right);
result.changed |= was_pressed;
return result;
}
SetupResult SetupScreen::handle_click(int x, int y, bool right) {
if (x < 0 || y < 0 || x >= 320 || y >= 240) return {};
if (right) return {false, SetupRequest::new_game};
if (!joining_) {
@@ -122,8 +151,12 @@ Image SetupScreen::render() const {
if (joining_ && (!joining_arrow_permission_[b] ||
(difficulty_arrows_locked_ && (b == 1 || b == 5))))
continue;
copy_rect(out, atlas_, 0x36 + (b > 3 ? 0x26 : 0), button_source_y_,
button_x_[b], button_y_[b], 0x26, 0x26);
// Held down by the mouse: the darker picture at the bottom of the atlas (not a shifted copy of the raised one).
if (pressed_button_ == b)
copy_rect(out, atlas_, b > 3 ? 0x26 : 0, atlas_.height - 0x26, button_x_[b], button_y_[b], 0x26, 0x26);
else
copy_rect(out, atlas_, 0x36 + (b > 3 ? 0x26 : 0), button_source_y_,
button_x_[b], button_y_[b], 0x26, 0x26);
}
const int values[] = {options_.duration, options_.difficulty, options_.managers, options_.mode};
for (int i = 0; i < 4; ++i) {
+5
View File
@@ -42,9 +42,14 @@ public:
SetupScreen(const std::filesystem::path& data, SetupOptions current);
const SetupOptions& options() const { return options_; }
SetupResult click(int x, int y, bool right_button = false);
// Mouse DOWN on a minus or plus button: drawn pressed until the release (click()). True when the picture changed.
bool press(int x, int y);
Image render() const;
private:
int button_at(int x, int y) const;
SetupResult handle_click(int x, int y, bool right);
int pressed_button_ = -1; // minus/plus button held down by the mouse
SetupOptions options_;
Image background_, atlas_;
std::array<int, 8> button_x_{}, button_y_{};
+12
View File
@@ -17,6 +17,18 @@ int main(int argc, char** argv) {
const auto before = screen.options();
check(before == SetupOptions{}, "original defaults");
check(screen.render().pixels.size() == 320*240, "native framebuffer");
{ // minus and plus look pressed (the darker picture) while held, raised again after the release
SetupScreen probe(argv[1]);
const auto raised = probe.render();
check(!probe.press(5, 5) && !probe.press(130, 214), "no pressed look outside the buttons");
check(probe.press(30, 30) && probe.render().pixels != raised.pixels, "minus shows the pressed look");
check(!probe.press(30, 30), "an unchanged press does not redraw");
check(probe.press(260, 30) && probe.render().pixels != raised.pixels, "plus shows the pressed look");
probe.click(5, 5); // released elsewhere: the button is raised again and nothing is changed
check(probe.render().pixels == raised.pixels && probe.options() == SetupOptions{}, "the release ends the pressed look");
probe.press(260, 30);
check(probe.click(260, 30).changed, "the release redraws even when the value cannot change");
}
check(!screen.click(-1, 30).changed && !screen.click(320, 239, true).changed, "outside viewport");
check(screen.click(130, 214).request == SetupRequest::none, "gap between controls");
check(screen.click(214, 215).request == SetupRequest::load_game, "disk requests load");