shirosaki / enjoyable

an application for Mac OS X which allows you to use controller inputs like a mouse or keyboard
143 stars 29 forks source link

[Feature request] Pulse width modulation for sticks #3

Open Finesse opened 5 years ago

Finesse commented 5 years ago

On consoles many games like racing consider the sticks angle: if the stick is leaned a bit, the virtual car turns a bit, if the stick is leaned to the full angle, the car turns as hard as it can. It would be great if Enjoyable can transmit this behavior of sticks and other analogue controls.

I understand that a keyboard doesn't have analogue keys so the sticks can't be emulated directly. But there is a trick to implement it. Enjoyable can emulate fast key pressing and releasing when a stick is leaned halfway. The more the stick is leaned, the longer the press time than the release time. A similar trick is used in electronics to turn discrete to analogue and it's called «pulse width modulation».

(percent is a stick lean angle, x is time, y is the emulated key state: top - pressed, bottom - released)

patrickfx commented 4 years ago

That's cool idea. Even though I do not need it immediatly. And what impress me, it's how far you describe the idea with graph. !!!