Tweak joysticks and add CSS variables #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry I had this project abandoned for a long time (again). I did notice the latest issues and PR filed and I will look at them when I find the time. As usual, I come with more changes after a long hiatus.
This PR mixes several small changes with big changes; the most drastic one is that all settings hardcoded in the JavaScript side are now moved to the CSS side, along with the layouts and their style options. This allows us to potentially have different settings for different controls and/or different layouts.
Here is an excerpt from current
base.css
. Currently it's way too verbose and could possibly be better organized:This also allows us to fine-tune the behaviour of joysticks. For the moment, default options for the joysticks are:
s
, rectangular joysticks with a lineal, scaled dead zone per axis, and a joystick which doesn't auto-centre when releasedj
, same as above, but the joystick auto-centres.t
, same as above, but the joystick is now round and the dead zone is radial. The controller will start to vibrate and the input will be rescaled when the joystick goes beyond this round border.These defaults can be changed through the options
--shape
and--center-deadzone
. In the future, I will probably add a--sticky
flag and extend the--shape
parameter to more types of control (for example, to better control the aesthetics of buttons).Also, controls are reported in a different order; this avoids unexpected behaviours such as the first and more important button being under the thumb joysticks by default. (All programs that depend on Yoke, and some programs on Linux can't look at the event codes in
events.py
.)In a future update, I can add a flag to
yoke
so that the D-Pad will be reported as a hat switch. This should improve the auto-detection of the D-Pad in both OSs (because, again, programs cannot or will not notice the BTN_DPAD scancodes). This still requires some testing and changes that would conflict with PR #62 by JingMatrix, so I decided to postpone working on this.