Add MouseButton.MIDDLE, SCROLL_UP, SCROLL_DOWN support

- Register middle mouse button in PyScene (was missing, events were dropped)
- Add SCROLL_UP (10) and SCROLL_DOWN (11) to MouseButton enum
- Update button string-to-enum conversion in PyCallable and PyScene
- Legacy string comparisons work: MouseButton.SCROLL_UP == "wheel_up"

closes #231, closes #232

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-01-28 23:22:16 -05:00
commit b47132b052
3 changed files with 25 additions and 8 deletions

View file

@ -70,13 +70,15 @@ void PyClickCallable::call(sf::Vector2f mousepos, std::string button, std::strin
return;
}
// Convert button string to MouseButton enum (#222)
// Convert button string to MouseButton enum (#222, #232)
int button_val = 0; // Default to LEFT
if (button == "left") button_val = 0;
else if (button == "right") button_val = 1;
else if (button == "middle") button_val = 2;
else if (button == "x1") button_val = 3;
else if (button == "x2") button_val = 4;
else if (button == "wheel_up") button_val = 10; // SCROLL_UP
else if (button == "wheel_down") button_val = 11; // SCROLL_DOWN
PyObject* button_enum = nullptr;
if (PyMouseButton::mouse_button_enum_class) {