Open
Conversation
added 8 commits
January 8, 2022 18:37
This commit adds CSS variables and a codebase that for now, is unused. In a future commit, most variables will be read from the CSS instead of hardcoded in the JavaScript. This allows users to both fine-tune Yoke more easily, and also to fix settings per layout and per control (for example, the first button from a given layout might need extra force to be pushed). CSS blocks have also been moved around for the user's convenience. Critical parameters that users should not touch are now at the bottom of the file. Parameters at the top will be overridden by parameters at the bottom, following normal CSS priority rules. No examples are given for this, but parameters bound to any specific control by ID (e.g. "#j1") would be given a higher priority.
Joysticks can now be elliptical, square, round or rectangular. A central deadzone is also supported, which depends on the joystick shape: rectangular joysticks have axial deadzones (evaluated separately for each component), while round joysticks have a single radial deadzone. Both deadzones are scaled, meaning that output grows gradually from the edge of the deadzone to the edge of the joystick.
- D-pad and knobs are compatible now with all four shapes - D-pads, knobs, and joysticks use similar CSS and JS - Knobs have now an image (made with Inkscape and manually trimmed down), - D-pads use now CSS filters instead of hardcoded shadows
Also, remove bg.svg, bm.svg, bs.svg, which have been superseded by button.svg#bg, #bm and #bs.
Several programs on Linux (and all programs in Windows, due to a design decision on Yoke) ignore the semantics of every button and only look at the order in which they are reported. Because of this, the JavaScript side now reorders controls to simplify most configurations (face buttons should go first, then in-game menu buttons, then thumbstick buttons, and then special buttons like the branded key to open the system menu, which is even less used in this scenario).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
--shapeand--center-deadzone. In the future, I will probably add a--stickyflag and extend the--shapeparameter 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
yokeso 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.