pyglet / pyglet

pyglet is a cross-platform windowing and multimedia library for Python, for developing games and other visually rich applications.
http://pyglet.org
BSD 3-Clause "New" or "Revised" License
1.78k stars 294 forks source link

input.controller: Properly handle inverted axis as dpad #1078

Closed benmoran56 closed 2 months ago

benmoran56 commented 2 months ago

When dpads are bound to axis controls (like hats), two opposing directions share the same physical control. They therefore share the same Control event. Rather than dispatching two events for every direction pushed, this PR dynamically sets the correct operator and actuation limits to use. The same event is used, and the correct comparisons are made for cases where the binding is inverted or set to negative.